diff --exclude=config.php -crN 2017_base/admin/admin_forums.php 2017_oractx/admin/admin_forums.php
*** 2017_base/admin/admin_forums.php	Tue Jul 19 21:14:56 2005
--- 2017_oractx/admin/admin_forums.php	Sat Sep 17 15:23:32 2005
***************
*** 392,402 ****
  			}
  
  			// There is no problem having duplicate forum names so we won't check for it.
! 			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
! 				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
! 			if( !$result = $db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
  			}
  
  			if( $HTTP_POST_VARS['prune_enable'] )
--- 392,415 ----
  			}
  
  			// There is no problem having duplicate forum names so we won't check for it.
! 
! 			if (SQL_LAYER == 'oracle') {
! 				$sql = "INSERT INTO " . FORUMS_TABLE . 
! 					" (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ") ".
! 					"VALUES (" . $next_id . ", :FNAME, " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", :FDESC, ". $next_order .", " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
! 				if( !$result = $db->sql_query($sql, END_TRANSACTION, Array(":FNAME", ":FDESC"), 
! 					Array($HTTP_POST_VARS["forumname"], $HTTP_POST_VARS["forumdesc"]) ))
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
! 				}
! 			}
! 			else {
! 				$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
! 					VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
! 				if( !$result = $db->sql_query($sql) )
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
! 				}
  			}
  
  			if( $HTTP_POST_VARS['prune_enable'] )
***************
*** 431,444 ****
  				}
  			}
  
! 			$sql = "UPDATE " . FORUMS_TABLE . "
! 				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
! 				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
! 			if( !$result = $db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
  			}
  
  			if( $HTTP_POST_VARS['prune_enable'] == 1 )
  			{
  				if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
--- 444,468 ----
  				}
  			}
  
! 			if (SQL_LAYER == 'oracle') {
! 				$sql = "UPDATE " . FORUMS_TABLE . "
! 					SET forum_name = :FNAME, cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = :FDESC, forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
! 					WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
! 				if( !$result = $db->sql_query($sql, END_TRANSACTION, Array(":FNAME", ":FDESC"), 
! 					Array($HTTP_POST_VARS["forumname"], $HTTP_POST_VARS["forumdesc"]) ))
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
! 				}
  			}
+ 			else {
+ 				$sql = "UPDATE " . FORUMS_TABLE . "
+ 					SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . " WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
+ 				if( !$result = $db->sql_query($sql) )
+ 				{
+ 					message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
+ 				}
  
+ 			}
  			if( $HTTP_POST_VARS['prune_enable'] == 1 )
  			{
  				if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
***************
*** 499,509 ****
  			//
  			// There is no problem having duplicate forum names so we won't check for it.
  			//
! 			$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
! 				VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)";
! 			if( !$result = $db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
  			}
  
  			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
--- 523,544 ----
  			//
  			// There is no problem having duplicate forum names so we won't check for it.
  			//
! 			if (SQL_LAYER == 'oracle') {
! 				$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
! 					VALUES (:CNAME, $next_order)";
! 				if( !$result = $db->sql_query($sql, END_TRANSACTION, Array(":CNAME"), 
! 					Array($HTTP_POST_VARS['categoryname']) ) )
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
! 				}
! 			}
! 			else {
! 				$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
! 					VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)";
! 				if( !$result = $db->sql_query($sql) )
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
! 				}
  			}
  
  			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
***************
*** 547,558 ****
  
  		case 'modcat':
  			// Modify a category in the DB
! 			$sql = "UPDATE " . CATEGORIES_TABLE . "
! 				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
! 				WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
! 			if( !$result = $db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
  			}
  
  			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
--- 582,604 ----
  
  		case 'modcat':
  			// Modify a category in the DB
! 			if (SQL_LAYER == 'oracle') {
! 				$sql = "UPDATE " . CATEGORIES_TABLE . 
! 					" SET cat_title = :CNAME ".
! 					" WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
! 				if( !$result = $db->sql_query($sql, END_TRANSACTION, Array(":CNAME"), Array($HTTP_POST_VARS["cat_title"])) )
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
! 				}
! 			}
! 			else {
! 				$sql = "UPDATE " . CATEGORIES_TABLE . "
! 					SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
! 					WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
! 				if( !$result = $db->sql_query($sql) )
! 				{
! 					message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
! 				}
  			}
  
  			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
diff --exclude=config.php -crN 2017_base/admin/index.php 2017_oractx/admin/index.php
*** 2017_base/admin/index.php	Tue Jul 19 21:14:56 2005
--- 2017_oractx/admin/index.php	Sat Sep 17 15:23:32 2005
***************
*** 287,292 ****
--- 287,304 ----
  			$dbsize = $lang['Not_available'];
  		}
  	}
+ 	else if( preg_match("/^oracle/", SQL_LAYER) )
+ 	{
+ 		$sql = "SELECT SUM(bytes) AS dbsize FROM user_segments";
+ 		if( $result = $db->sql_query($sql) )
+ 		{
+ 			$dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available'];
+ 		}
+ 		else
+ 		{
+ 			$dbsize = $lang['Not_available'];
+ 		}
+ 	}
  	else
  	{
  		$dbsize = $lang['Not_available'];
diff --exclude=config.php -crN 2017_base/config.ora_sample.php 2017_oractx/config.ora_sample.php
*** 2017_base/config.ora_sample.php	Thu Jan  1 01:00:00 1970
--- 2017_oractx/config.ora_sample.php	Sat Sep 17 15:23:32 2005
***************
*** 0 ****
--- 1,18 ----
+ <?php
+ 
+ // This variable should contain the TNS name of your Oracle instance
+ $dbhost = 'ORASVR.WORLD';
+ // This variable is the Oracle user name
+ $dbuser = 'PHPBB2';
+ // This variable is the password for the user name above
+ $dbpasswd = '2BBPHP';
+ 
+ // Shouldn't need to change anything below here.
+ $dbname = $dbhost;
+ $dbms = 'oracle';
+ $table_prefix = 'phpbb_';
+ 
+ define('PHPBB_INSTALLED', true);
+ 
+ ?>
+ 
diff --exclude=config.php -crN 2017_base/db/oracle.php 2017_oractx/db/oracle.php
*** 2017_base/db/oracle.php	Thu Jan  1 01:00:00 1970
--- 2017_oractx/db/oracle.php	Sat Sep 17 15:23:32 2005
***************
*** 0 ****
--- 1,459 ----
+ <?php
+ /***************************************************************************
+  *                                oracle.php
+  *                            -------------------
+  *   begin                : Thrusday Feb 15, 2001
+  *   copyright            : (C) 2001 The phpBB Group
+  *   email                : support@phpbb.com
+  *
+  *   $Id: oracle.php,v 1.18.2.1 2002/11/26 11:42:12 psotfx Exp $
+  *
+  ***************************************************************************/
+ 
+ /***************************************************************************
+  *
+  *   This program is free software; you can redistribute it and/or modify
+  *   it under the terms of the GNU General Public License as published by
+  *   the Free Software Foundation; either version 2 of the License, or
+  *   (at your option) any later version.
+  *
+  ***************************************************************************/
+ 
+ if(!defined("SQL_LAYER"))
+ {
+ 
+ define("SQL_LAYER","oracle");
+ 
+ class sql_db
+ {
+ 
+ 	var $db_connect_id;
+ 	var $query_result;
+ 	var $in_transaction = 0;
+ 	var $row = array();
+ 	var $rowset = array();
+ 	var $num_queries = 0;
+ 	var $last_query_text = "";
+ 
+ 	//
+ 	// Constructor
+ 	//
+ 	function sql_db($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true)
+ 	{
+ 		$this->persistency = $persistency;
+ 		$this->user = $sqluser;
+ 		$this->password = $sqlpassword;
+ 		$this->server = $sqlserver;
+ 		$this->dbname = $database;
+ 
+ 		if($this->persistency)
+ 		{
+ 			$this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server);
+ 		}
+ 		else
+ 		{
+ 			$this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server);
+ 		}
+ 		if($this->db_connect_id)
+ 		{
+ 			$sql = "ALTER SESSION SET CURSOR_SHARING = FORCE";
+ 			$query_result = @OCIParse($this->db_connect_id, $sql);
+ 			@OCIExecute($query_result, OCI_DEFAULT);
+ 
+ 			return $this->db_connect_id;
+ 		}
+ 		else
+ 		{
+ 			print_r(OCIError());
+ 			return false;
+ 		}
+ 	}
+ 
+ 	//
+ 	// Other base methods
+ 	//
+ 	function sql_close()
+ 	{
+ 		if($this->db_connect_id)
+ 		{
+ 			// Commit outstanding transactions
+ 			if($this->in_transaction)
+ 			{
+ 				OCICommit($this->db_connect_id);
+ 			}
+ 
+ 			if($this->query_result)
+ 			{
+ 				@OCIFreeStatement($this->query_result);
+ 			}
+ 			$result = @OCILogoff($this->db_connect_id);
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 
+ 	//
+ 	// Base query method
+ 	//
+ 	function sql_query($query = "", $transaction = FALSE, $clobtoset = null, $clobvalue = null)
+ 	{
+ 		// Remove any pre-existing queries
+ 		unset($this->query_result);
+ 
+ 		// Put us in transaction mode because with Oracle as soon as you make a query you're in a transaction
+ 		$this->in_transaction = TRUE;
+ 
+ 		if($query != "")
+ 		{
+ 			$this->last_query = $query;
+ 			$this->num_queries++;
+ 
+ 			// Only apply the Oracle limit w/a for "SELECT ...LIMIT n, n" type queries
+ 			if (preg_match("/^(SELECT\s.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits))
+ 			{
+ 				$query = $limits[1];
+ 				if($limits[3])
+ 				{
+ 					$row_offset = $limits[2];
+ 					$num_rows = $limits[3];
+ 				}
+ 				else
+ 				{
+ 					$row_offset = 0;
+ 					$num_rows = $limits[2];
+ 				}
+ 				$start_row = $row_offset;
+ 				$end_row = strval(intval($start_row) + intval($num_rows));
+ 				$temp_query = $query;
+ 				$temp_replacement = "WHERE rownum >= ".$start_row." AND rownum <= ".$end_row." AND ";
+ 				$query = "SELECT * FROM (SELECT /*+ FIRST_ROWS */ rownum AS xrownum, a.* FROM (".$temp_query.") a WHERE  rownum <= ".$end_row.") WHERE xrownum >= ".$start_row;
+ 			}
+ 
+ 			if(eregi("^(INSERT|UPDATE) ", $query))
+ 			{
+ 				$query = preg_replace("/\\\'/s", "''", $query);
+ 			}
+ 			$this->query_result = @OCIParse($this->db_connect_id, $query);
+ 			for ($bv = 0; $bv < count($clobtoset); $bv++) {
+ 				$_clobvalue[$bv] = preg_replace("/\\\(&|\"|\\\|')/s", "$1", $clobvalue[$bv]);
+ 				@OCIBindByName($this->query_result, $clobtoset[$bv], $_clobvalue[$bv], -1);
+ 			}
+ 			$success = @OCIExecute($this->query_result, OCI_DEFAULT);
+ 		}
+ 		if($success)
+ 		{
+ 			if($transaction == END_TRANSACTION)
+ 			{
+ 				OCICommit($this->db_connect_id);
+ 				$this->in_transaction = FALSE;
+ 			}
+ 
+ 			unset($this->row[$this->query_result]);
+ 			unset($this->rowset[$this->query_result]);
+ 			$this->last_query_text[$this->query_result] = $query;
+ 
+ 			return $this->query_result;
+ 		}
+ 		else
+ 		{
+ 			if($this->in_transaction)
+ 			{
+ 				OCIRollback($this->db_connect_id);
+ 			}
+ 			return false;
+ 		}
+ 	}
+ 
+ 	//
+ 	// Other query methods
+ 	//
+ 	function sql_numrows($query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$result = @OCIFetchStatement($query_id, $this->rowset);
+ 			// OCIFetchStatment kills our query result so we have to execute the statment again
+ 			// if we ever want to use the query_id again.
+ 			@OCIExecute($query_id, OCI_DEFAULT);
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_affectedrows($query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$result = @OCIRowCount($query_id);
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_numfields($query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$result = @OCINumCols($query_id);
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_fieldname($offset, $query_id = 0)
+ 	{
+ 		// OCIColumnName uses a 1 based array so we have to up the offset by 1 in here to maintain
+ 		// full abstraction compatibitly
+ 		$offset += 1;
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$result = strtolower(@OCIColumnName($query_id, $offset));
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_fieldtype($offset, $query_id = 0)
+ 	{
+ 		// This situation is the same as fieldname
+ 		$offset += 1;
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$result = @OCIColumnType($query_id, $offset);
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_fetchrow($query_id = 0, $debug = FALSE)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$result_row = "";
+ 			$result = @OCIFetchInto($query_id, $result_row, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+ 			if($debug)
+ 			{
+ 				echo "Query was: ".$this->last_query . "<br>";
+ 				echo "Result: $result<br>";
+ 				echo "Query ID: $query_id<br>";
+ 				echo "<pre>";
+ 				var_dump($result_row);
+ 				echo "</pre>";
+ 			}
+ 			if($result_row == "")
+ 			{
+ 				return false;
+ 			}
+ 
+ 			for($i = 0; $i < count($result_row); $i++)
+ 			{
+ 				list($key, $val) = each($result_row);
+ 				$return_arr[strtolower($key)] = $val;
+ 			}
+ 			$this->row[$query_id] = $return_arr;
+ 
+ 			return $this->row[$query_id];
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_fetchrowset($query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			$rows = @OCIFetchStatement($query_id, $results);
+ 
+ 			for ($row = 0; $row < $rows; $row++) 
+ 			{
+ 				reset($results);
+ 				while ( list( $key, $val ) = each( $results ) ) {
+ 					$newrow[strtolower($key)] = $val[$row];
+ 				}
+ 				$result[] = $newrow;
+ 			}
+ /*
+ 	// amannering performance change - Original comment:
+ 	// This function probably isn't as efficant is it could be but any other way I do it
+ 	// I end up losing 1 row...
+ 			@OCIExecute($query_id, OCI_DEFAULT);
+ 			for($i = 0; $i < $rows; $i++)
+ 			{
+ 				@OCIFetchInto($query_id, $tmp_result, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+ 
+ 				for($j = 0; $j < count($tmp_result); $j++)
+ 				{
+ 					list($key, $val) = each($tmp_result);
+ 					$return_arr[strtolower($key)] = $val;
+ 				}
+ 				$result[] = $return_arr;
+ 			}
+ */
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_fetchfield($field, $rownum = -1, $query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 			if($rownum > -1)
+ 			{
+ 				// Reset the internal rownum pointer.
+ 				@OCIExecute($query_id, OCI_DEFAULT);
+ 				for($i = 0; $i < $rownum; $i++)
+ 				  {
+ 						// Move the interal pointer to the row we want
+ 						@OCIFetch($query_id);
+ 				  }
+ 				// Get the field data.
+ 				$result = @OCIResult($query_id, strtoupper($field));
+ 			}
+ 			else
+ 			{
+ 				// The internal pointer should be where we want it
+ 				// so we just grab the field out of the current row.
+ 				$result = @OCIResult($query_id, strtoupper($field));
+ 			}
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 	function sql_rowseek($rownum, $query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 				$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 				@OCIExecute($query_id, OCI_DEFAULT);
+ 			for($i = 0; $i < $rownum; $i++)
+ 				{
+ 					@OCIFetch($query_id);
+ 				}
+ 			$result = @OCIFetch($query_id);
+ 			return $result;
+ 		}
+ 		else
+ 		{
+ 				return false;
+ 		}
+ 	}
+ 	function sql_nextid($query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		if($query_id && $this->last_query_text[$query_id] != "")
+ 		{
+ 			if( eregi("^(INSERT INTO{1}|^INSERT  INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename))
+ 			{
+ 				$query = "SELECT ".$tablename[2]."_id_seq.currval FROM DUAL";
+ 				$stmt = @OCIParse($this->db_connect_id, $query);
+ 				@OCIExecute($stmt,OCI_DEFAULT );
+ 				$tmp_result = @OCIFetchInto($stmt, $temp_result, OCI_ASSOC+OCI_RETURN_NULLS);
+ 				if($tmp_result)
+ 				{
+ 					return $temp_result['CURRVAL'];
+ 				}
+ 				else
+ 				{
+ 					return false;
+ 				}
+ 			}
+ 			else
+ 			{
+ 				return false;
+ 			}
+ 		}
+ 		else
+ 		{
+ 			return false;
+ 		}
+ 	}
+ 
+ 	function sql_freeresult($query_id = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 				$query_id = $this->query_result;
+ 		}
+ 		if($query_id)
+ 		{
+ 				$result = @OCIFreeStatement($query_id);
+ 				return $result;
+ 		}
+ 		else
+ 		{
+ 				return false;
+ 		}
+ 	}
+ 	function sql_error($query_id  = 0)
+ 	{
+ 		if(!$query_id)
+ 		{
+ 			$query_id = $this->query_result;
+ 		}
+ 		$result  = @OCIError($query_id);
+ 		return $result;
+ 	}
+ 
+ } // class sql_db
+ 
+ } // if ... define
+ 
+ ?>
\ No newline at end of file
diff --exclude=config.php -crN 2017_base/includes/constants.php 2017_oractx/includes/constants.php
*** 2017_base/includes/constants.php	Tue Jul 19 21:14:56 2005
--- 2017_oractx/includes/constants.php	Sat Sep 17 15:23:32 2005
***************
*** 156,170 ****
  define('DISALLOW_TABLE', $table_prefix.'disallow');
  define('FORUMS_TABLE', $table_prefix.'forums');
  define('GROUPS_TABLE', $table_prefix.'groups');
  define('POSTS_TABLE', $table_prefix.'posts');
! define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');
  define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
! define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text');
  define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore');
  define('PRUNE_TABLE', $table_prefix.'forum_prune');
  define('RANKS_TABLE', $table_prefix.'ranks');
  define('SEARCH_TABLE', $table_prefix.'search_results');
  define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist');
  define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch');
  define('SESSIONS_TABLE', $table_prefix.'sessions');
  define('SMILIES_TABLE', $table_prefix.'smilies');
--- 156,172 ----
  define('DISALLOW_TABLE', $table_prefix.'disallow');
  define('FORUMS_TABLE', $table_prefix.'forums');
  define('GROUPS_TABLE', $table_prefix.'groups');
+ define('ORA_PRUNE_TOPICS', $table_prefix.'prune_topics_temp');
  define('POSTS_TABLE', $table_prefix.'posts');
! define('POSTS_TEXT_TABLE', $table_prefix.'posts_text_clob');
  define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
! define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text_clob');
  define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore');
  define('PRUNE_TABLE', $table_prefix.'forum_prune');
  define('RANKS_TABLE', $table_prefix.'ranks');
  define('SEARCH_TABLE', $table_prefix.'search_results');
  define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist');
+ define('SEARCH_WORD_TABLE_TEMP', $table_prefix.'search_wordlist_temp');
  define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch');
  define('SESSIONS_TABLE', $table_prefix.'sessions');
  define('SMILIES_TABLE', $table_prefix.'smilies');
***************
*** 179,182 ****
  define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
  define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
  
! ?>
\ No newline at end of file
--- 181,185 ----
  define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
  define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
  
! define('ORACLE_CTX_UPDATE_ASAP', 0);
! ?>
diff --exclude=config.php -crN 2017_base/includes/functions_post.php 2017_oractx/includes/functions_post.php
*** 2017_base/includes/functions_post.php	Tue Jul 19 21:14:56 2005
--- 2017_oractx/includes/functions_post.php	Sat Sep 17 15:23:32 2005
***************
*** 243,253 ****
  		}
  	}
  
- 	if ($mode == 'editpost')
- 	{
- 		remove_search_post($post_id);
- 	}
- 
  	if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
  	{
  		$topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;
--- 243,248 ----
***************
*** 276,298 ****
  		$post_id = $db->sql_nextid();
  	}
  
  	$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
  	if (!$db->sql_query($sql))
  	{
  		message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
  	}
! 
! 	add_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject));
  
  	//
  	// Add poll
  	// 
  	if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && !empty($poll_title) && count($poll_options) >= 2)
  	{
! 		$sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ($poll_length * 86400) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ($poll_length * 86400) . " WHERE topic_id = $topic_id";
! 		if (!$db->sql_query($sql))
! 		{
! 			message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
  		}
  
  		$delete_option_sql = '';
--- 271,312 ----
  		$post_id = $db->sql_nextid();
  	}
  
+ 	switch (SQL_LAYER) {
+ 		case 'oracle':
+ 			$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, :POST_SUBJECT, '$bbcode_uid', :POST_TEXT)" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = :POST_TEXT,  bbcode_uid = '$bbcode_uid', post_subject = :POST_SUBJECT WHERE post_id = $post_id";
+ 			if (!$db->sql_query($sql, false, Array(":POST_SUBJECT", ":POST_TEXT"), Array($post_subject, $post_message)))
+ 			{
+ 				message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
+ 			}
+ 			posts_sync_ctx_index_now();
+ 			break;
+ 		default:
  	$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
  	if (!$db->sql_query($sql))
  	{
  		message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
  	}
! break;
! }
  
  	//
  	// Add poll
  	// 
  	if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && !empty($poll_title) && count($poll_options) >= 2)
  	{
! 		if (SQL_LAYER == 'oracle') {
! 			$sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, :VTEXT,  $current_time, " . ($poll_length * 86400) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = :VTEXT, vote_length = " . ($poll_length * 86400) . " WHERE topic_id = $topic_id";
! 			if (!$db->sql_query($sql, false, Array(":VTEXT"), Array($poll_title) ))
! 			{
! 				message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
! 			}
! 		}
! 		else {
! 			$sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ($poll_length * 86400) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ($poll_length * 86400) . " WHERE topic_id = $topic_id";
! 			if (!$db->sql_query($sql))
! 			{
! 				message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
! 			}
  		}
  
  		$delete_option_sql = '';
***************
*** 330,342 ****
  		{
  			if (!empty($option_text))
  			{
- 				$option_text = str_replace("\'", "''", htmlspecialchars($option_text));
  				$poll_result = ($mode == "editpost" && isset($old_poll_result[$option_id])) ? $old_poll_result[$option_id] : 0;
  
! 				$sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
! 				if (!$db->sql_query($sql))
! 				{
! 					message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
  				}
  				$poll_option_id++;
  			}
--- 344,366 ----
  		{
  			if (!empty($option_text))
  			{
  				$poll_result = ($mode == "editpost" && isset($old_poll_result[$option_id])) ? $old_poll_result[$option_id] : 0;
  
! 				if (SQL_LAYER == 'oracle') {
! 					$option_text = htmlspecialchars($option_text);
! 					$sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, :OPT_TEXT, $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = :OPT_TEXT, vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
! 					if (!$db->sql_query($sql, false, Array(":OPT_TEXT"), Array($option_text) ))
! 					{
! 						message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
! 					}
! 				}
! 				else {
! 					$option_text = str_replace("\'", "''", htmlspecialchars($option_text));
! 					$sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
! 					if (!$db->sql_query($sql))
! 					{
! 						message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
! 					}
  				}
  				$poll_option_id++;
  			}
***************
*** 525,531 ****
  			}
  		}
  
- 		remove_search_post($post_id);
  	}
  
  	if ($mode == 'poll_delete' || ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post']) && $post_data['has_poll'] && $post_data['edit_poll'])
--- 549,554 ----
***************
*** 859,862 ****
  	}
  }
  
! ?>
\ No newline at end of file
--- 882,885 ----
  	}
  }
  
! ?>
diff --exclude=config.php -crN 2017_base/includes/functions_search.php 2017_oractx/includes/functions_search.php
*** 2017_base/includes/functions_search.php	Tue Jul 19 21:14:56 2005
--- 2017_oractx/includes/functions_search.php	Sat Sep 17 15:23:32 2005
***************
*** 102,425 ****
  	return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
  }
  
! function add_search_words($mode, $post_id, $post_text, $post_title = '')
! {
! 	global $db, $phpbb_root_path, $board_config, $lang;
! 
! 	$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_stopwords.txt"); 
! 	$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_synonyms.txt"); 
! 
! 	$search_raw_words = array();
! 	$search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array));
! 	$search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array));
! 
! 	@set_time_limit(0);
! 
! 	$word = array();
! 	$word_insert_sql = array();
! 	while ( list($word_in, $search_matches) = @each($search_raw_words) )
! 	{
! 		$word_insert_sql[$word_in] = '';
! 		if ( !empty($search_matches) )
! 		{
! 			for ($i = 0; $i < count($search_matches); $i++)
! 			{ 
! 				$search_matches[$i] = trim($search_matches[$i]);
! 
! 				if( $search_matches[$i] != '' ) 
! 				{
! 					$word[] = $search_matches[$i];
! 					if ( !strstr($word_insert_sql[$word_in], "'" . $search_matches[$i] . "'") )
! 					{
! 						$word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != "" ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
! 					}
! 				} 
! 			}
! 		}
! 	}
! 
! 	if ( count($word) )
! 	{
! 		sort($word);
! 
! 		$prev_word = '';
! 		$word_text_sql = '';
! 		$temp_word = array();
! 		for($i = 0; $i < count($word); $i++)
! 		{
! 			if ( $word[$i] != $prev_word )
! 			{
! 				$temp_word[] = $word[$i];
! 				$word_text_sql .= ( ( $word_text_sql != '' ) ? ', ' : '' ) . "'" . $word[$i] . "'";
! 			}
! 			$prev_word = $word[$i];
! 		}
! 		$word = $temp_word;
! 
! 		$check_words = array();
! 		switch( SQL_LAYER )
! 		{
! 			case 'postgresql':
! 			case 'msaccess':
! 			case 'mssql-odbc':
! 			case 'oracle':
! 			case 'db2':
! 				$sql = "SELECT word_id, word_text     
! 					FROM " . SEARCH_WORD_TABLE . " 
! 					WHERE word_text IN ($word_text_sql)";
! 				if ( !($result = $db->sql_query($sql)) )
! 				{
! 					message_die(GENERAL_ERROR, 'Could not select words', '', __LINE__, __FILE__, $sql);
! 				}
! 
! 				while ( $row = $db->sql_fetchrow($result) )
! 				{
! 					$check_words[$row['word_text']] = $row['word_id'];
! 				}
! 				break;
! 		}
! 
! 		$value_sql = '';
! 		$match_word = array();
! 		for ($i = 0; $i < count($word); $i++)
! 		{ 
! 			$new_match = true;
! 			if ( isset($check_words[$word[$i]]) )
! 			{
! 				$new_match = false;
! 			}
! 
! 			if ( $new_match )
! 			{
! 				switch( SQL_LAYER )
! 				{
! 					case 'mysql':
! 					case 'mysql4':
! 						$value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\', 0)';
! 						break;
! 					case 'mssql':
! 					case 'mssql-odbc':
! 						$value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "', 0";
! 						break;
! 					default:
! 						$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
! 							VALUES ('" . $word[$i] . "', 0)"; 
! 						if( !$db->sql_query($sql) )
! 						{
! 							message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
! 						}
! 						break;
! 				}
! 			}
! 		}
! 
! 		if ( $value_sql != '' )
! 		{
! 			switch ( SQL_LAYER )
! 			{
! 				case 'mysql':
! 				case 'mysql4':
! 					$sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
! 						VALUES $value_sql"; 
! 					break;
! 				case 'mssql':
! 				case 'mssql-odbc':
! 					$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
! 						$value_sql"; 
! 					break;
! 			}
! 
! 			if ( !$db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
! 			}
! 		}
! 	}
! 
! 	while( list($word_in, $match_sql) = @each($word_insert_sql) )
! 	{
! 		$title_match = ( $word_in == 'title' ) ? 1 : 0;
! 
! 		if ( $match_sql != '' )
! 		{
! 			$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) 
! 				SELECT $post_id, word_id, $title_match  
! 					FROM " . SEARCH_WORD_TABLE . " 
! 					WHERE word_text IN ($match_sql)"; 
! 			if ( !$db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql);
! 			}
! 		}
! 	}
! 
! 	if ($mode == 'single')
! 	{
! 		remove_common('single', 4/10, $word);
! 	}
! 
! 	return;
! }
! 
! //
! // Check if specified words are too common now
! //
! function remove_common($mode, $fraction, $word_id_list = array())
  {
  	global $db;
! 
! 	$sql = "SELECT COUNT(post_id) AS total_posts 
! 		FROM " . POSTS_TABLE;
! 	if ( !($result = $db->sql_query($sql)) )
! 	{
! 		message_die(GENERAL_ERROR, 'Could not obtain post count', '', __LINE__, __FILE__, $sql);
! 	}
! 
! 	$row = $db->sql_fetchrow($result);
! 
! 	if ( $row['total_posts'] >= 100 )
! 	{
! 		$common_threshold = floor($row['total_posts'] * $fraction);
! 
! 		if ( $mode == 'single' && count($word_id_list) )
! 		{
! 			$word_id_sql = '';
! 			for($i = 0; $i < count($word_id_list); $i++)
! 			{
! 				$word_id_sql .= ( ( $word_id_sql != '' ) ? ', ' : '' ) . "'" . $word_id_list[$i] . "'";
! 			}
! 
! 			$sql = "SELECT m.word_id 
! 				FROM " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w 
! 				WHERE w.word_text IN ($word_id_sql)  
! 					AND m.word_id = w.word_id 
! 				GROUP BY m.word_id 
! 				HAVING COUNT(m.word_id) > $common_threshold";
! 		}
! 		else 
! 		{
! 			$sql = "SELECT word_id 
! 				FROM " . SEARCH_MATCH_TABLE . " 
! 				GROUP BY word_id 
! 				HAVING COUNT(word_id) > $common_threshold";
! 		}
! 
! 		if ( !($result = $db->sql_query($sql)) )
! 		{
! 			message_die(GENERAL_ERROR, 'Could not obtain common word list', '', __LINE__, __FILE__, $sql);
! 		}
! 
! 		$common_word_id = '';
! 		while ( $row = $db->sql_fetchrow($result) )
! 		{
! 			$common_word_id .= ( ( $common_word_id != '' ) ? ', ' : '' ) . $row['word_id'];
! 		}
! 		$db->sql_freeresult($result);
! 
! 		if ( $common_word_id != '' )
! 		{
! 			$sql = "UPDATE " . SEARCH_WORD_TABLE . "
! 				SET word_common = " . TRUE . " 
! 				WHERE word_id IN ($common_word_id)";
! 			if ( !$db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
! 			}
! 
! 			$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "  
! 				WHERE word_id IN ($common_word_id)";
! 			if ( !$db->sql_query($sql) )
! 			{
! 				message_die(GENERAL_ERROR, 'Could not delete word match entry', '', __LINE__, __FILE__, $sql);
! 			}
! 		}
! 	}
! 
! 	return;
! }
! 
! function remove_search_post($post_id_sql)
! {
! 	global $db;
! 
! 	$words_removed = false;
! 
! 	switch ( SQL_LAYER )
! 	{
! 		case 'mysql':
! 		case 'mysql4':
! 			$sql = "SELECT word_id 
! 				FROM " . SEARCH_MATCH_TABLE . " 
! 				WHERE post_id IN ($post_id_sql) 
! 				GROUP BY word_id";
! 			if ( $result = $db->sql_query($sql) )
! 			{
! 				$word_id_sql = '';
! 				while ( $row = $db->sql_fetchrow($result) )
! 				{
! 					$word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; 
! 				}
! 
! 				$sql = "SELECT word_id 
! 					FROM " . SEARCH_MATCH_TABLE . " 
! 					WHERE word_id IN ($word_id_sql) 
! 					GROUP BY word_id 
! 					HAVING COUNT(word_id) = 1";
! 				if ( $result = $db->sql_query($sql) )
! 				{
! 					$word_id_sql = '';
! 					while ( $row = $db->sql_fetchrow($result) )
! 					{
! 						$word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; 
  					}
- 
- 					if ( $word_id_sql != '' )
- 					{
- 						$sql = "DELETE FROM " . SEARCH_WORD_TABLE . " 
- 							WHERE word_id IN ($word_id_sql)";
- 						if ( !$db->sql_query($sql) )
- 						{
- 							message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
- 						}
- 
- 						$words_removed = $db->sql_affectedrows();
- 					}
- 				}
- 			}
- 			break;
- 
- 		default:
- 			$sql = "DELETE FROM " . SEARCH_WORD_TABLE . " 
- 				WHERE word_id IN ( 
- 					SELECT word_id 
- 					FROM " . SEARCH_MATCH_TABLE . " 
- 					WHERE word_id IN ( 
- 						SELECT word_id 
- 						FROM " . SEARCH_MATCH_TABLE . " 
- 						WHERE post_id IN ($post_id_sql) 
- 						GROUP BY word_id 
- 					) 
- 					GROUP BY word_id 
- 					HAVING COUNT(word_id) = 1
- 				)"; 
- 			if ( !$db->sql_query($sql) )
- 			{
- 				message_die(GENERAL_ERROR, 'Could not delete old words from word table', '', __LINE__, __FILE__, $sql);
- 			}
- 
- 			$words_removed = $db->sql_affectedrows();
- 
- 			break;
- 	}
- 
- 	$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "  
- 		WHERE post_id IN ($post_id_sql)";
- 	if ( !$db->sql_query($sql) )
- 	{
- 		message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
- 	}
- 
- 	return $words_removed;
  }
  
  //
--- 102,114 ----
  	return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
  }
  
! function posts_sync_ctx_index_now()
  {
  	global $db;
! 	if (SQL_LAYER == 'oracle' and ORACLE_CTX_UPDATE_ASAP == 1) {
! 		$sql = "BEGIN CTX_DDL.SYNC_INDEX('PTC_TEXT_CTX'); CTX_DDL.SYNC_INDEX('PTC_SUBJECT_CTX'); END;";
! 		$db->sql_query($sql);
  					}
  }
  
  //
diff --exclude=config.php -crN 2017_base/includes/prune.php 2017_oractx/includes/prune.php
*** 2017_base/includes/prune.php	Tue Jul 19 21:14:56 2005
--- 2017_oractx/includes/prune.php	Sat Sep 17 15:23:32 2005
***************
*** 46,51 ****
--- 46,63 ----
  		$sql .= " AND p.post_time < $prune_date";
  	}
  
+ 	switch (SQL_LAYER)
+ 	{
+ 		case 'oracle':
+ 			$sql = "INSERT INTO " . ORA_PRUNE_TOPICS . " (topic_id) " . $sql;
+ 			if ( !($result = $db->sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Could not make list of topics to prune', '', __LINE__, __FILE__, $sql);
+ 			}
+ 			$sql = "SELECT topic_id FROM " . ORA_PRUNE_TOPICS;
+ 			break;
+ 	}
+ 	
  	if ( !($result = $db->sql_query($sql)) )
  	{
  		message_die(GENERAL_ERROR, 'Could not obtain lists of topics to prune', '', __LINE__, __FILE__, $sql);
***************
*** 60,72 ****
  		
  	if( $sql_topics != '' )
  	{
! 		$sql = "SELECT post_id
  			FROM " . POSTS_TABLE . " 
  			WHERE forum_id = $forum_id 
  				AND topic_id IN ($sql_topics)";
! 		if ( !($result = $db->sql_query($sql)) )
  		{
! 			message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
  		}
  
  		$sql_post = '';
--- 72,91 ----
  		
  	if( $sql_topics != '' )
  	{
! 		switch (SQL_LAYER)
! 		{
! 			case 'oracle':
! 				$sql_topics = "SELECT topic_id FROM " . ORA_PRUNE_TOPICS;
! 				break;
! 		}
! 	
! 		$sql_posts = "SELECT post_id
  			FROM " . POSTS_TABLE . " 
  			WHERE forum_id = $forum_id 
  				AND topic_id IN ($sql_topics)";
! 		if ( !($result = $db->sql_query($sql_posts)) )
  		{
! 			message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql_posts);
  		}
  
  		$sql_post = '';
***************
*** 78,83 ****
--- 97,105 ----
  
  		if ( $sql_post != '' )
  		{
+ 			if (SQL_LAYER == 'oracle')
+ 				$sql_post = $sql_posts;
+ 
  			$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " 
  				WHERE topic_id IN ($sql_topics)";
  			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
***************
*** 110,120 ****
  				message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
  			}
  
- 			remove_search_post($sql_post);
- 
  			return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
  		}
  	}
  
  	return array('topics' => 0, 'posts' => 0);
  }
--- 132,150 ----
  				message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
  			}
  
  			return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
  		}
  	}
+ 	switch (SQL_LAYER)
+ 	{
+ 		case 'oracle':
+ 			$sql = "DELETE FROM " . ORA_PRUNE_TOPICS ;
+ 			if ( !($result = $db->sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Could not clear list of topics to prune', '', __LINE__, __FILE__, $sql);
+ 			}
+ 			break;
+ 	}
  
  	return array('topics' => 0, 'posts' => 0);
  }
diff --exclude=config.php -crN 2017_base/index.php 2017_oractx/index.php
*** 2017_base/index.php	Tue Jul 19 21:14:58 2005
--- 2017_oractx/index.php	Sat Sep 17 15:23:32 2005
***************
*** 149,156 ****
  		case 'oracle':
  			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 
  				FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
! 				WHERE p.post_id = f.forum_last_post_id(+)
! 					AND u.user_id = p.poster_id(+)
  				ORDER BY f.cat_id, f.forum_order";
  			break;
  
--- 149,156 ----
  		case 'oracle':
  			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 
  				FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
! 				WHERE p.post_id(+) = f.forum_last_post_id
! 					AND u.user_id(+) = p.poster_id
  				ORDER BY f.cat_id, f.forum_order";
  			break;
  
diff --exclude=config.php -crN 2017_base/modcp.php 2017_oractx/modcp.php
*** 2017_base/modcp.php	Tue Jul 19 21:14:58 2005
--- 2017_oractx/modcp.php	Sat Sep 17 15:23:32 2005
***************
*** 345,351 ****
  					message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
  				}
  
! 				remove_search_post($post_id_sql);
  			}
  
  			if ( $vote_id_sql != '' )
--- 345,351 ----
  					message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
  				}
  
! 				posts_sync_ctx_index_now();
  			}
  
  			if ( $vote_id_sql != '' )
diff --exclude=config.php -crN 2017_base/posting.php 2017_oractx/posting.php
*** 2017_base/posting.php	Tue Jul 19 21:14:58 2005
--- 2017_oractx/posting.php	Sat Sep 17 15:23:32 2005
***************
*** 551,557 ****
--- 551,565 ----
  			{
  				$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;
  
+ 				switch (SQL_LAYER) 
+ 				{
+ 					case 'oracle':
+ 						submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), $subject, $message, str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
+ 						break;
+ 					default:
  				submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
+ 						break;
+ 				}
  			}
  			break;
  
diff --exclude=config.php -crN 2017_base/privmsg.php 2017_oractx/privmsg.php
*** 2017_base/privmsg.php	Tue Jul 19 21:14:58 2005
--- 2017_oractx/privmsg.php	Sat Sep 17 15:23:32 2005
***************
*** 338,349 ****
--- 338,362 ----
  
  		$privmsg_sent_id = $db->sql_nextid();
  
+ 		switch (SQL_LAYER)
+ 		{
+ 			case 'oracle':
+ 				$sql = "INSERT $sql_priority INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
+ 					VALUES ($privmsg_sent_id, '" . $privmsg['privmsgs_bbcode_uid'] . "', :PRIV_MSG_TEXT )";
+ 				if ( !$db->sql_query($sql, false, Array(":PRIV_MSG_TEXT"), Array($privmsg['privmsgs_text'])) )
+ 				{
+ 					message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql);
+ 				}
+ 				break;
+ 			default:
  		$sql = "INSERT $sql_priority INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
  			VALUES ($privmsg_sent_id, '" . $privmsg['privmsgs_bbcode_uid'] . "', '" . str_replace("\'", "''", addslashes($privmsg['privmsgs_text'])) . "')";
  		if ( !$db->sql_query($sql) )
  		{
  			message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql);
  		}
+ 				break;
+ 		}
  	}
  
  	//
***************
*** 1272,1290 ****
  		{
  			$privmsg_sent_id = $db->sql_nextid();
  
  			$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
  				VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')";
  		}
  		else
  		{
  			$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
  				SET privmsgs_text = '" . str_replace("\'", "''", $privmsg_message) . "', privmsgs_bbcode_uid = '$bbcode_uid' 
  				WHERE privmsgs_text_id = $privmsg_id";
  		}
  
  		if ( !$db->sql_query($sql, END_TRANSACTION) )
  		{
! 			message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);
  		}
  
  		if ( $mode != 'edit' )
--- 1285,1333 ----
  		{
  			$privmsg_sent_id = $db->sql_nextid();
  
+ 			switch (SQL_LAYER)
+ 			{
+ 				case 'oracle':
+ 					$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
+ 						VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', :PRIV_MSG_TEXT )";
+ 					break;
+ 				default:
  			$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
  				VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')";
+ 					break;
+ 			}
  		}
  		else
  		{
+ 			switch (SQL_LAYER)
+ 			{
+ 				case 'oracle':
+ 					$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
+ 						SET privmsgs_text = :PRIV_MSG_TEXT , privmsgs_bbcode_uid = '$bbcode_uid' 
+ 						WHERE privmsgs_text_id = $privmsg_id";
+ 					break;
+ 				default:
  			$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
  				SET privmsgs_text = '" . str_replace("\'", "''", $privmsg_message) . "', privmsgs_bbcode_uid = '$bbcode_uid' 
  				WHERE privmsgs_text_id = $privmsg_id";
+ 					break;
+ 			}
  		}
  
+ 		switch (SQL_LAYER)
+ 		{
+ 			case 'oracle':
+ 				if ( !$db->sql_query($sql, END_TRANSACTION, Array(":PRIV_MSG_TEXT"), Array($privmsg_message)) )
+ 				{
+ 					message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
+ 				}
+ 				break;
+ 			default:
  		if ( !$db->sql_query($sql, END_TRANSACTION) )
  		{
! 					message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
! 				}
! 				break;
  		}
  
  		if ( $mode != 'edit' )
diff --exclude=config.php -crN 2017_base/search.php 2017_oractx/search.php
*** 2017_base/search.php	Tue Jul 19 21:14:58 2005
--- 2017_oractx/search.php	Sat Sep 17 15:23:32 2005
***************
*** 259,266 ****
  			$split_search = array();
  			$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);	
  
- 			$search_msg_only = ( !$search_fields ) ? "AND m.title_match = 0" : ( ( strstr($multibyte_charset, $lang['ENCODING']) ) ? '' : '' );
- 
  			$word_count = 0;
  			$current_match_type = 'or';
  
--- 259,264 ----
***************
*** 297,320 ****
  
  						if ( !strstr($multibyte_charset, $lang['ENCODING']) )
  						{
! 							$match_word = str_replace('*', '%', $split_search[$i]);
! 							$sql = "SELECT m.post_id 
! 								FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m 
! 								WHERE w.word_text LIKE '$match_word' 
! 									AND m.word_id = w.word_id 
! 									AND w.word_common <> 1 
  									$search_msg_only";
  						}
  						else
  						{
  							$match_word =  addslashes('%' . str_replace('*', '', $split_search[$i]) . '%');
! 							$search_msg_only = ( $search_fields ) ? "OR post_subject LIKE '$match_word'" : '';
  							$sql = "SELECT post_id
  								FROM " . POSTS_TEXT_TABLE . "
! 								WHERE post_text LIKE '$match_word'
  								$search_msg_only";
  						}
! 						if ( !($result = $db->sql_query($sql)) )
  						{
  							message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
  						}
--- 295,318 ----
  
  						if ( !strstr($multibyte_charset, $lang['ENCODING']) )
  						{
! 							$match_word =  $split_search[$i];
! 
! 							$search_msg_only = ( $search_fields ) ? "OR CONTAINS(post_subject, :WORD, 2) > 0" : '';
! 							$sql = "SELECT post_id
! 								FROM " . POSTS_TEXT_TABLE . " 
! 								WHERE CONTAINS(post_text, :WORD, 1) > 0
  									$search_msg_only";
  						}
  						else
  						{
  							$match_word =  addslashes('%' . str_replace('*', '', $split_search[$i]) . '%');
! 							$search_msg_only = ( $search_fields ) ? "OR post_subject LIKE :WORD" : '';
  							$sql = "SELECT post_id
  								FROM " . POSTS_TEXT_TABLE . "
! 								WHERE post_text LIKE :WORD
  								$search_msg_only";
  						}
! 						if ( !($result = $db->sql_query($sql, false, Array(":WORD"), Array($match_word))) )
  						{
  							message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
  						}
***************
*** 733,739 ****
  	{
  		if ( $show_results == 'posts' )
  		{
! 			$sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid  
  				FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt 
  				WHERE p.post_id IN ($search_results)
  					AND pt.post_id = p.post_id
--- 731,737 ----
  	{
  		if ( $show_results == 'posts' )
  		{
! 			$sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id as fforum_id, f.forum_name, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, t.topic_status, t.topic_vote, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_moved_id, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid  
  				FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt 
  				WHERE p.post_id IN ($search_results)
  					AND pt.post_id = p.post_id
***************
*** 743,749 ****
  		}
  		else
  		{
! 			$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
  				FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
  				WHERE t.topic_id IN ($search_results) 
  					AND t.topic_poster = u.user_id
--- 741,747 ----
  		}
  		else
  		{
! 			$sql = "SELECT t.*, f.forum_id as fforum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
  				FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
  				WHERE t.topic_id IN ($search_results) 
  					AND t.topic_poster = u.user_id