<!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>[128368] trunk/dports/security/base</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">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/128368">128368</a></dd>
<dt>Author</dt> <dd>khindenburg@macports.org</dd>
<dt>Date</dt> <dd>2014-11-19 19:49:03 -0800 (Wed, 19 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>base (port): update to 1.4.5; add patch php ereg_replace deprecated, mysqli usage instead of deprecated one; add license; patches from #42857</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportssecuritybasePortfile">trunk/dports/security/base/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/dports/security/base/files/</li>
<li><a href="#trunkdportssecuritybasefilespatchbasediff">trunk/dports/security/base/files/patch-base.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportssecuritybasePortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/security/base/Portfile (128367 => 128368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/security/base/Portfile        2014-11-20 02:54:57 UTC (rev 128367)
+++ trunk/dports/security/base/Portfile        2014-11-20 03:49:03 UTC (rev 128368)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> PortSystem          1.0
</span><span class="cx"> 
</span><span class="cx"> name                base
</span><del>-version             1.3.9
</del><ins>+version             1.4.5
</ins><span class="cx"> categories          security
</span><span class="cx"> maintainers         nomaintainer
</span><span class="cx"> description         Basic Analysis and Security Engine - Snort web frontend
</span><span class="lines">@@ -12,12 +12,22 @@
</span><span class="cx">                     project. It provides a web front-end to query and analyze \
</span><span class="cx">                     the alerts from SNORT.
</span><span class="cx"> platforms           darwin
</span><del>-homepage            http://secureideas.sourceforge.net/
</del><ins>+license             GPL-2
+homepage            http://base.professionallyevil.com
</ins><span class="cx"> master_sites        sourceforge:secureideas
</span><del>-checksums           md5 66e50f45c6bbf6b0cb2913b8c67f50d6
</del><ins>+
+checksums           rmd160  e66552039a806d09db40f1e7f363b2cd68cde064 \
+                    sha256  23910f5277ceb43398442074e444182941bf7f6da85efd84ecdd0cf62c4b8935
+
</ins><span class="cx"> depends_run         port:gd2 \
</span><del>-                    port:adodb
</del><ins>+                    port:adodb \
+                    port:pear-Mail port:pear-Mail_Mime port:pear-Image_Graph \
+                    port:pear-Image_Canvas port:pear-Image_Color port:pear-Numbers_Roman
</ins><span class="cx"> 
</span><ins>+## http://sourceforge.net/p/secureideas/patches/27/
+## +mysql support through mysqli extension
+patchfiles         patch-base.diff
+
</ins><span class="cx"> use_configure       no
</span><span class="cx"> build               {}
</span><span class="cx"> 
</span><span class="lines">@@ -26,15 +36,28 @@
</span><span class="cx"> 
</span><span class="cx"> destroot {
</span><span class="cx">     xinstall -m 755 -d ${destroot}${basedir}
</span><del>-    xinstall -m 755 -d ${destroot}${docsdir}
-    system &quot;cd ${worksrcpath} &amp;&amp; cp -R . ${destroot}${basedir}&quot;
-    system &quot;cd ${worksrcpath}/docs/ &amp;&amp; cp -R . ${destroot}${docsdir}&quot;
</del><ins>+
+    foreach file [glob -directory ${worksrcpath}/ *] {
+        copy ${file} ${destroot}${basedir}/
+    }
+
+    reinplace &quot;s|\$DBlib_path = '';|\$DBlib_path = '${prefix}/share/adodb5';|g&quot; ${destroot}${basedir}/base_conf.php.dist
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> post-activate {
</span><del>-ui_msg &quot;\n
-Make sure to customize ${prefix}/share/base/base_conf.php.dist
-\n&quot;
</del><ins>+    ## Not sure if needed. If the file exists, wizard says you need to delete it
+    if ![file exists ${basedir}/base_conf.php ] {
+        copy ${basedir}/base_conf.php.dist ${basedir}/base_conf.php
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+notes &quot;
+Read the files under ${prefix}/share/base/docs, especially README and INSTALL.
+
+Note that this software is installed under ${prefix}/share/base
+
+This version was released in 2010 and the authors consider it BETA;
+you may want to consider other software options.
+&quot;
+
</ins><span class="cx"> livecheck.regex   ${name}-(\[0-9.\]+)${extract.suffix}
</span></span></pre></div>
<a id="trunkdportssecuritybasefilespatchbasediff"></a>
<div class="addfile"><h4>Added: trunk/dports/security/base/files/patch-base.diff (0 => 128368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/security/base/files/patch-base.diff                                (rev 0)
+++ trunk/dports/security/base/files/patch-base.diff        2014-11-20 03:49:03 UTC (rev 128368)
</span><span class="lines">@@ -0,0 +1,450 @@
</span><ins>+diff -urN ../base-1.4.5.orig/base_db_common.php ./base_db_common.php
+--- ../base-1.4.5.orig/base_db_common.php        2010-03-05 10:06:16.000000000 -0500
++++ ./base_db_common.php        2014-03-12 15:00:22.000000000 -0400
+@@ -80,7 +80,7 @@
+             &quot; &quot;._ERRPHPERROR2.&quot;&lt;/FONT&gt;&quot;;
+   }

+-  if ( ($DBtype == &quot;mysql&quot;) || ($DBtype == &quot;mysqlt&quot;) )
++  if ( ($DBtype == &quot;mysql&quot;) || ($DBtype == &quot;mysqlt&quot;) || ($DBtype == &quot;mysqli&quot;))
+   {
+      if ( !(function_exists(&quot;mysql_connect&quot;)) )
+      {
+diff -urN ../base-1.4.5.orig/base_graph_display.php ./base_graph_display.php
+--- ../base-1.4.5.orig/base_graph_display.php        2010-03-05 10:06:17.000000000 -0500
++++ ./base_graph_display.php        2014-03-12 14:59:57.000000000 -0400
+@@ -114,7 +114,7 @@
+   else
+   { 
+     // Create the graph area, legends on bottom -- Alejandro
+-    $Graph =&amp; new Image_Graph(array('driver'=&gt;'gd', 
++    $Graph = new Image_Graph(array('driver'=&gt;'gd',
+                                     'width'=&gt;$width,
+                                     'height'=&gt;$height));
+   }
+@@ -320,27 +320,27 @@

+       // special case '&quot;I0&quot; =&gt; &quot;private network (rfc 1918)&quot;' and
+       // '&quot;** (private network) &quot; =&gt; &quot;private network (rfc 1918)&quot;'
+-      if (ereg(&quot;rfc 1918&quot;, $tmp, $substring) || (ereg(&quot;[*][*] \(private network\) &quot;, $tmp_lower, $substring)))
++      if (preg_match(&quot;/rfc 1918/&quot;, $tmp, $substring) || (preg_match(&quot;/[*][*] \(private network\) /&quot;, $tmp_lower, $substring)))
+       {
+         $Dataset-&gt;addPoint(&quot;private network (rfc 1918)&quot;, $xdata[$i][1]);
+       }
+       // special case '?? (Not Found) ' =&gt; 'unknown'
+-      elseif(ereg(&quot;[?][?][ \t]+\(Not Found\)[ \t]*&quot;, $tmp, $substring))
++      elseif(preg_match(&quot;/[?][?][ \t]+\(Not Found\)[ \t]*/&quot;, $tmp, $substring))
+       {
+         $Dataset-&gt;addPoint(&quot;unknown&quot;, $xdata[$i][1]);
+       }
+       // anything inside parentheses, following a 2-letter TLD:
+-      elseif (ereg(&quot;^[-a-zA-Z0-9]{2}[ \t]\((.+)\)[ \t]*$&quot;, $tmp, $substring))
++      elseif (preg_match(&quot;/^[-a-zA-Z0-9]{2}[ \t]\((.+)\)[ \t]*$/&quot;, $tmp, $substring))
+       {
+         $Dataset-&gt;addPoint($substring[1], $xdata[$i][1]);
+       }
+       // anything after two-letter top level domain names and after one space or tab:
+-      elseif (ereg(&quot;[ \t]*[-a-zA-Z0-9]{2}[ \t]([-a-zA-Z0-9]+[-a-zA-Z0-9 ]*)&quot;, $tmp, $substring))
++      elseif (preg_match(&quot;/[ \t]*[-a-zA-Z0-9]{2}[ \t]([-a-zA-Z0-9]+[-a-zA-Z0-9 ]*)/&quot;, $tmp, $substring))
+       {
+         $Dataset-&gt;addPoint($substring[1], $xdata[$i][1]);
+       }
+       // two-letter top level domain names right at the beginning:
+-      elseif (ereg(&quot;[ \t]*([-a-zA-Z0-9]{2})[ \t]&quot;, $tmp_lower, $substring))
++      elseif (preg_match(&quot;/[ \t]*([-a-zA-Z0-9]{2})[ \t]/&quot;, $tmp_lower, $substring))
+       {
+         $Dataset-&gt;addPoint($substring[1], $xdata[$i][1]);
+       }
+diff -urN ../base-1.4.5.orig/base_qry_common.php ./base_qry_common.php
+--- ../base-1.4.5.orig/base_qry_common.php        2010-03-05 10:06:17.000000000 -0500
++++ ./base_qry_common.php        2014-03-12 14:59:53.000000000 -0400
+@@ -773,10 +773,10 @@
+            }
+         }
+         /* if have chosen the address type to be both source and destination */
+-        if ( ereg(&quot;ip_both&quot;, $tmp) )
++        if ( preg_match(&quot;/ip_both/&quot;, $tmp) )
+         {
+-           $tmp_src = ereg_replace(&quot;ip_both&quot;,&quot;ip_src&quot;,$tmp);
+-           $tmp_dst = ereg_replace(&quot;ip_both&quot;,&quot;ip_dst&quot;,$tmp);
++           $tmp_src = preg_replace(&quot;/ip_both/&quot;,&quot;ip_src&quot;,$tmp);
++           $tmp_dst = preg_replace(&quot;/ip_both/&quot;,&quot;ip_dst&quot;,$tmp);
+            
+            if ( $ip_addr[$i][2] == '=' )
+              $tmp = &quot;(&quot;.$tmp_src.') OR ('.$tmp_dst.')';
+diff -urN ../base-1.4.5.orig/base_qry_sqlcalls.php ./base_qry_sqlcalls.php
+--- ../base-1.4.5.orig/base_qry_sqlcalls.php        2010-03-05 10:06:17.000000000 -0500
++++ ./base_qry_sqlcalls.php        2014-03-12 14:59:53.000000000 -0400
+@@ -259,9 +259,9 @@
+            $line = split (&quot; &quot;, $current_sig_txt);
+            foreach ($line as $ps_element) 
+            {
+-             if ( ereg(&quot;[0-9]*\.[0-9]*\.[0-9]*\.[0-9]&quot;, $ps_element)  )
++             if ( preg_match(&quot;/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]/&quot;, $ps_element)  )
+              {
+-                $ps_element = ereg_replace (&quot;:&quot;, &quot;&quot;, $ps_element);
++                $ps_element = preg_replace (&quot;/:/&quot;, &quot;&quot;, $ps_element);
+                 qroPrintEntry(&quot;&lt;A HREF=\&quot;base_stat_ipaddr.php?ip=&quot;.$ps_element.&quot;&amp;amp;netmask=32\&quot;&gt;&quot;.
+                               $ps_element.&quot;&lt;/A&gt;&quot;);
+              }
+diff -urN ../base-1.4.5.orig/base_stat_common.php ./base_stat_common.php
+--- ../base-1.4.5.orig/base_stat_common.php        2010-03-05 10:06:17.000000000 -0500
++++ ./base_stat_common.php        2014-03-12 15:00:16.000000000 -0400
+@@ -312,7 +312,7 @@
+    if (!stristr($where, &quot;WHERE&quot;) &amp;&amp; $where != &quot;&quot;)
+         $where = &quot; WHERE $where &quot;;

+-   if ( $db-&gt;DB_type == &quot;mysql&quot; )
++   if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot; )
+    {
+      if ( $join == &quot;&quot; &amp;&amp; $where == &quot;&quot;)
+        $result = $db-&gt;baseExecute(&quot;SELECT COUNT(DISTINCT acid_event.ip_src, acid_event.ip_dst, acid_event.ip_proto) FROM acid_event&quot;);
+diff -urN ../base-1.4.5.orig/base_stat_ipaddr.php ./base_stat_ipaddr.php
+--- ../base-1.4.5.orig/base_stat_ipaddr.php        2010-03-05 10:06:17.000000000 -0500
++++ ./base_stat_ipaddr.php        2014-03-12 14:59:53.000000000 -0400
+@@ -135,7 +135,7 @@
+    print &quot;&lt;/PRE&gt;&lt;BR&gt;\n&quot;;
+    */

+-   if(ereg($ip, $contents)) {
++   if(preg_match(&quot;/$ip/&quot;, $contents)) {
+      $total++;
+      if( $total % 2 == 0 ) {
+         $color=&quot;DDDDDD&quot;;
+@@ -143,7 +143,7 @@
+         $color=&quot;FFFFFF&quot;;
+      }

+-     $contents = ereg_replace(&quot;  &quot;, &quot; &quot;, $contents);
++     $contents = preg_replace(&quot;/  /&quot;, &quot; &quot;, $contents);
+      $elements = explode(&quot; &quot;, $contents);

+      echo '&lt;tr bgcolor=&quot;'.$color.'&quot;&gt;&lt;td align=&quot;center&quot;&gt;'.
+@@ -183,7 +183,7 @@
+      print &quot;&lt;/PRE&gt;&lt;/TD&gt;&quot;;

+      /*
+-     ereg(&quot;([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*):([0-9]*)&quot;,$elements[3],$store);
++     preg_match(&quot;/([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*):([0-9]*)/&quot;,$elements[3],$store);
+      $source_ip = $store[1];
+      $source_port = $store[2];
+      if (empty($source_ip))
+@@ -197,7 +197,7 @@
+      echo '&lt;td align=&quot;center&quot;&gt;' . $source_ip  . '&lt;/td&gt;';
+      echo '&lt;td align=&quot;center&quot;&gt;' . $source_port . '&lt;/td&gt;';

+-     ereg(&quot;([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*):([0-9]*)&quot;,$elements[5],$store);
++     preg_match(&quot;/([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*):([0-9]*)/&quot;,$elements[5],$store);
+      $destination_ip = $store[1];
+      $destination_port = $store[2];
+      if (empty($destination_ip))
+diff -urN ../base-1.4.5.orig/includes/base_db.inc.php ./includes/base_db.inc.php
+--- ../base-1.4.5.orig/includes/base_db.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./includes/base_db.inc.php        2014-03-12 15:00:09.000000000 -0400
+@@ -77,7 +77,16 @@
+   {
+      GLOBAL $sql_trace_mode, $sql_trace_file;
+  
+-     $this-&gt;DB = NewADOConnection();
++     // If they have mysqli, use it. Otherwise, fall back to the older &quot;mysql&quot; extension.
++     if ($this-&gt;DB_type == 'mysql') {
++         if (extension_loaded('mysqli')) {
++             $this-&gt;DB_type = 'mysqli';
++         } else {
++             $this-&gt;DB_type = 'mysql';
++         }
++     }
++
++     $this-&gt;DB = NewADOConnection($this-&gt;DB_type);
+      $this-&gt;DB_name = $database;
+      $this-&gt;DB_host = $host;
+      $this-&gt;DB_port = $port;
+@@ -108,7 +117,7 @@

+      /* Set the database schema version number */
+      $sql = &quot;SELECT vseq FROM schema&quot;;
+-     if ($this-&gt;DB_type == &quot;mysql&quot;) $sql = &quot;SELECT vseq FROM `schema`&quot;; 
++     if ($this-&gt;DB_type == &quot;mysql&quot; || $this-&gt;DB_type == &quot;mysqli&quot;) $sql = &quot;SELECT vseq FROM `schema`&quot;; 
+      if ($this-&gt;DB_type == &quot;mssql&quot;) $sql = &quot;SELECT vseq FROM [schema]&quot;;

+      $result = $this-&gt;DB-&gt;Execute($sql);
+@@ -138,8 +147,17 @@
+   function basePConnect($database, $host, $port, $username, $password)
+   {
+      GLOBAL $sql_trace_mode, $sql_trace_file; 
++     
++     // If they have mysqli, use it. Otherwise, fall back to the older &quot;mysql&quot; extension.
++     if ($this-&gt;DB_type == 'mysql') {
++         if (extension_loaded('mysqli')) {
++             $this-&gt;DB_type = 'mysqli';
++         } else {
++             $this-&gt;DB_type = 'mysql';
++         }
++     }

+-     $this-&gt;DB = NewADOConnection();
++     $this-&gt;DB = NewADOConnection($this-&gt;DB_type);
+      $this-&gt;DB_name = $database;
+      $this-&gt;DB_host = $host;
+      $this-&gt;DB_port = $port;
+@@ -171,7 +189,7 @@
+      /* Set the database schema version number */
+      $sql = &quot;SELECT vseq FROM schema&quot;; 
+      if ($this-&gt;DB_type == &quot;mssql&quot;) $sql = &quot;SELECT vseq FROM [schema]&quot;;
+-     if ($this-&gt;DB_type == &quot;mysql&quot;) $sql = &quot;SELECT vseq FROM `schema`&quot;;
++     if ($this-&gt;DB_type == &quot;mysql&quot; || $this-&gt;DB_type == &quot;mysqli&quot;) $sql = &quot;SELECT vseq FROM `schema`&quot;;

+      $result = $this-&gt;DB-&gt;Execute($sql);
+      if ( $this-&gt;baseErrorMessage() != &quot;&quot; )
+@@ -209,7 +227,7 @@
+      /* ** Begin DB specific SQL fix-up ** */
+      if ($this-&gt;DB_type == &quot;mssql&quot;)
+      {
+-        $sql = eregi_replace(&quot;''&quot;, &quot;NULL&quot;, $sql);
++        $sql = preg_replace(&quot;/''/i&quot;, &quot;NULL&quot;, $sql);
+      }

+      if ($this-&gt;DB_type == &quot;oci8&quot;)
+@@ -231,7 +249,7 @@
+         $rs = new baseRS($this-&gt;DB-&gt;Execute($sql), $this-&gt;DB_type);
+      else
+      {
+-        if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || 
++        if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) ||
+              ($this-&gt;DB_type == &quot;maxsql&quot;) )
+         {
+            $rs =  new baseRS($this-&gt;DB-&gt;Execute($sql.&quot; LIMIT &quot;.$start_row.&quot;, &quot;.$num_rows),
+@@ -321,7 +339,7 @@
+    * the current point, so it can't be here and needs to be in the actual script after calling this function
+    *  -- srh (02/01/2001)
+    */
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || 
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) ||
+           ($this-&gt;DB_type == &quot;maxsql&quot;) || ($this-&gt;DB_type == &quot;mssql&quot;))
+         return $this-&gt;DB-&gt;Insert_ID();
+      else if ($this-&gt;DB_type == &quot;postgres&quot; ||($this-&gt;DB_type == &quot;oci8&quot;))
+@@ -336,7 +354,7 @@

+   function baseSQL_YEAR($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || 
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) ||
+           ($this-&gt;DB_type == &quot;maxsql&quot;) || ($this-&gt;DB_type == &quot;mssql&quot;) )
+         return &quot; YEAR($func_param) $op $timestamp &quot;;
+      else if( $this-&gt;DB_type == &quot;oci8&quot; )
+@@ -347,7 +365,7 @@

+   function baseSQL_MONTH($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || 
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) ||
+           ($this-&gt;DB_type == &quot;maxsql&quot;) || ($this-&gt;DB_type == &quot;mssql&quot;) )
+         return &quot; MONTH($func_param) $op $timestamp &quot;;
+      else if( $this-&gt;DB_type == &quot;oci8&quot; )
+@@ -358,7 +376,7 @@

+   function baseSQL_DAY($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
+         return &quot; DAYOFMONTH($func_param) $op $timestamp &quot;;
+      else if($this-&gt;DB_type == &quot;oci8&quot;)
+         return &quot; to_number( to_char( $func_param, 'DD' ) ) $op $timestamp &quot;;
+@@ -370,7 +388,7 @@

+   function baseSQL_HOUR($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
+         return &quot; HOUR($func_param) $op $timestamp &quot;;
+      else if($this-&gt;DB_type == &quot;oci8&quot;)
+         return &quot; to_number( to_char( $func_param, 'HH' ) ) $op $timestamp &quot;;
+@@ -382,7 +400,7 @@

+   function baseSQL_MINUTE($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
+         return &quot; MINUTE($func_param) $op $timestamp &quot;;
+      else if($this-&gt;DB_type == &quot;oci8&quot;)
+         return &quot; to_number( to_char( $func_param, 'MI' ) ) $op $timestamp &quot;;
+@@ -394,7 +412,7 @@

+   function baseSQL_SECOND($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
+         return &quot; SECOND($func_param) $op $timestamp &quot;;
+      else if($this-&gt;DB_type == &quot;oci8&quot;)
+         return &quot; to_number( to_char( $func_param, 'SS' ) ) $op $timestamp &quot;;
+@@ -406,7 +424,7 @@

+   function baseSQL_UNIXTIME($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
+      {
+         return &quot; UNIX_TIMESTAMP($func_param) $op $timestamp &quot;;
+      }
+@@ -432,7 +450,7 @@

+   function baseSQL_TIMESEC($func_param, $op, $timestamp)
+   {
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) )
+         return &quot; TIME_TO_SEC($func_param) $op $timestamp &quot;;
+      else if($this-&gt;DB_type == &quot;oci8&quot;)
+         return &quot; to_number( $func_param ) $op $timestamp &quot;;
+@@ -549,7 +567,7 @@
+  
+      // Is This if statement necessary?  -- Kevin
+      /* MS SQL Server 7, MySQL, Sybase, and Postgres natively support this function */ 
+-     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) ||
++     if ( ($this-&gt;DB_type == &quot;mysql&quot;) || ($this-&gt;DB_type == &quot;mysqlt&quot;) || ($this-&gt;DB_type == &quot;mysqli&quot;) || ($this-&gt;DB_type == &quot;maxsql&quot;) ||
+           ($this-&gt;DB_type == &quot;mssql&quot;) || ($this-&gt;DB_type == &quot;sybase&quot;) || ($this-&gt;DB_type == &quot;postgres&quot;) || ($this-&gt;DB_type == &quot;oci8&quot;))
+         return $this-&gt;row-&gt;RecordCount();

+@@ -623,6 +641,7 @@
+   if ( !(
+           ($type == &quot;mysql&quot;) ||
+           ($type == &quot;mysqlt&quot;) ||
++          ($type == &quot;mysqli&quot;) ||
+           ($type == &quot;maxsql&quot;) ||
+           ($type == &quot;postgres&quot;) ||
+           ($type == &quot;mssql&quot;) ||
+diff -urN ../base-1.4.5.orig/includes/base_net.inc.php ./includes/base_net.inc.php
+--- ../base-1.4.5.orig/includes/base_net.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./includes/base_net.inc.php        2014-03-12 14:59:53.000000000 -0400
+@@ -391,7 +391,7 @@
+         $line = explode(&quot; &quot;, $response_l[$i]);
+         for ($j=0; $j &lt; sizeof($line); $j++ )
+         {
+-          if ( eregi(&quot;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&quot;, $line[$j]) )
++          if ( preg_match(&quot;/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i&quot;, $line[$j]) )
+           {
+              if ( $email == &quot;&quot; )
+                 $email = $line[$j];
+diff -urN ../base-1.4.5.orig/includes/base_signature.inc.php ./includes/base_signature.inc.php
+--- ../base-1.4.5.orig/includes/base_signature.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./includes/base_signature.inc.php        2014-03-12 14:59:53.000000000 -0400
+@@ -139,7 +139,7 @@
+       {
+          if ($tmp_ref_system_name == &quot;snort&quot;)
+          {
+-           if (ereg(&quot;([0-9]+):([0-9]+)&quot;, $ref_tag, $backref))
++           if (preg_match(&quot;/([0-9]+):([0-9]+)/&quot;, $ref_tag, $backref))
+            {
+              if ($backref[1] == &quot;1&quot;)
+              {
+diff -urN ../base-1.4.5.orig/includes/base_state_citems.inc.php ./includes/base_state_citems.inc.php
+--- ../base-1.4.5.orig/includes/base_state_citems.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./includes/base_state_citems.inc.php        2014-03-12 14:59:53.000000000 -0400
+@@ -963,7 +963,7 @@
+       for ( $i = 0; $i &lt; $this-&gt;criteria_cnt; $i++ )
+       {
+         if ( (isset ($this-&gt;criteria[$i][3])) &amp;&amp;
+-             (ereg(&quot;([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)&quot;, $this-&gt;criteria[$i][3])) )
++             (preg_match(&quot;/([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)/&quot;, $this-&gt;criteria[$i][3])) )
+         {
+            $tmp_ip_str = $this-&gt;criteria[$i][7] = $this-&gt;criteria[$i][3];
+            $this-&gt;criteria[$i][3] = strtok($tmp_ip_str, &quot;.&quot;);
+diff -urN ../base-1.4.5.orig/includes/base_state_common.inc.php ./includes/base_state_common.inc.php
+--- ../base-1.4.5.orig/includes/base_state_common.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./includes/base_state_common.inc.php        2014-03-12 14:59:53.000000000 -0400
+@@ -181,7 +181,7 @@
+    if ( ($valid_data &amp; VAR_SCORE) &gt; 0 ) 
+       $regex_mask = $regex_mask . &quot;\-&quot;;

+-   return ereg_replace(&quot;[^&quot;.$regex_mask.&quot;]&quot;, &quot;&quot;, $item);
++   return preg_replace(&quot;/[^&quot;.$regex_mask.&quot;]/&quot;, &quot;&quot;, $item);
+ }

+ /* ***********************************************************************
+diff -urN ../base-1.4.5.orig/includes/base_state_criteria.inc.php ./includes/base_state_criteria.inc.php
+--- ../base-1.4.5.orig/includes/base_state_criteria.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./includes/base_state_criteria.inc.php        2014-03-12 14:59:53.000000000 -0400
+@@ -252,7 +252,7 @@
+    if ( isset($_POST['current_view']) ) $query_string .= &quot;&amp;amp;current_view=&quot;.$_POST['current_view'];
+    if ( isset($_POST['submit']) ) $query_string .= &quot;&amp;amp;submit=&quot;.$_POST['submit'];

+-   $query_string = ereg_replace(&quot;back=1&amp;&quot;, &quot;&quot;, CleanVariable($query_string, VAR_PERIOD | VAR_DIGIT | VAR_PUNC | VAR_LETTER));
++   $query_string = preg_replace(&quot;/back=1&amp;/&quot;, &quot;&quot;, CleanVariable($query_string, VAR_PERIOD | VAR_DIGIT | VAR_PUNC | VAR_LETTER));

+    ++$_SESSION['back_list_cnt'];
+    $_SESSION['back_list'][$_SESSION['back_list_cnt']] =  
+diff -urN ../base-1.4.5.orig/setup/setup2.php ./setup/setup2.php
+--- ../base-1.4.5.orig/setup/setup2.php        2010-03-05 10:06:18.000000000 -0500
++++ ./setup/setup2.php        2014-03-12 15:00:05.000000000 -0400
+@@ -68,6 +68,15 @@
+    $arcdbpasswd = ImportHTTPVar(&quot;arcdbpasswd&quot;);
+    $arcdbname = ImportHTTPVar(&quot;arcdbname&quot;, VAR_ALPHA | VAR_SCORE | VAR_USCORE);

++   // If they have mysqli, use it. Otherwise, fall back to the older &quot;mysql&quot; extension.
++   if ($dbtype == 'mysql') {
++       if (extension_loaded('mysqli')) {
++           $dbtype = 'mysqli';
++       } else {
++          $dbtype = 'mysql';
++       }
++   }
++
+    $db = NewADOConnection($dbtype);
+    $dbconnect = $db-&gt;Connect( ( ( $dbport == &quot;&quot;) ? $dbhost : ($dbhost.&quot;:&quot;.$dbport) ),
+                               $dbusername, $dbpasswd, $dbname);
+diff -urN ../base-1.4.5.orig/setup/setup_db.inc.php ./setup/setup_db.inc.php
+--- ../base-1.4.5.orig/setup/setup_db.inc.php        2010-03-05 10:06:18.000000000 -0500
++++ ./setup/setup_db.inc.php        2014-03-12 15:00:01.000000000 -0400
+@@ -45,7 +45,7 @@
+      }

+      if ( !$tblBaseAG_present ) {
+-        if ( $db-&gt;DB_type == &quot;mysql&quot; ) {
++        if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot;) {
+            $sql = 'CREATE TABLE acid_ag ( ag_id               INT           UNSIGNED NOT NULL AUTO_INCREMENT,
+                                           ag_name             VARCHAR(40),
+                                           ag_desc             TEXT,
+@@ -114,7 +114,7 @@
+      }

+      if ( !$tblBaseAGAlert_present ) {
+-        if ( $db-&gt;DB_type == &quot;mysql&quot; ) {
++        if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot;) {
+            $sql = 'CREATE TABLE acid_ag_alert( ag_id               INT           UNSIGNED NOT NULL,
+                                                ag_sid              INT           UNSIGNED NOT NULL,
+                                                ag_cid              INT           UNSIGNED NOT NULL,
+@@ -151,7 +151,7 @@
+      }

+      if ( !$tblBaseIPCache_present ) {
+-        if ( $db-&gt;DB_type == &quot;mysql&quot; ) {
++        if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot;) {
+            $sql = 'CREATE TABLE acid_ip_cache( ipc_ip                  INT UNSIGNED NOT NULL,
+                                                ipc_fqdn                VARCHAR(50),
+                                                ipc_dns_timestamp       DATETIME,
+@@ -193,7 +193,7 @@
+      }

+      if ( !$tblBaseEvent_present ) {
+-           if ( $db-&gt;DB_type == &quot;mysql&quot; ) {  
++           if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot;) {
+               if ( $db-&gt;baseGetDBversion() &lt; 100 )
+                  $sig_ddl = &quot;signature      VARCHAR(255) NOT NULL,&quot;;
+               else
+@@ -319,7 +319,7 @@
+       
+      /* Added for base_roles and base_users -- Kevin */
+      if ( !$tblBaseRoles_present ) {
+-           if ( $db-&gt;DB_type == &quot;mysql&quot; ) {
++           if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot;) {
+               $sql = 'CREATE TABLE base_roles ( role_id           int(11)         NOT NULL,
+                                                 role_name         varchar(20)     NOT NULL,
+                                                 role_desc         varchar(75)     NOT NULL,
+@@ -385,7 +385,7 @@
+      }

+      if ( !$tblBaseUsers_present ) {
+-           if ( $db-&gt;DB_type == &quot;mysql&quot; ) {
++           if ( $db-&gt;DB_type == &quot;mysql&quot; || $db-&gt;DB_type == &quot;mysqli&quot;) {
+               $sql = 'CREATE TABLE base_users ( usr_id            int(11)          NOT NULL,
+                                                 usr_login         varchar(25)      NOT NULL,
+                                                 usr_pwd           varchar(32)      NOT NULL,
</ins></span></pre>
</div>
</div>

</body>
</html>