diff --exclude=config.php -crN 2017_base/admin/admin_forums.php 2017_ora/admin/admin_forums.php
*** 2017_base/admin/admin_forums.php Tue Jul 19 21:14:56 2005
--- 2017_ora/admin/admin_forums.php Sat Sep 17 15:23:20 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'] . "
" . sprintf($lang['Click_return_forumadmin'], "", "") . "
" . sprintf($lang['Click_return_admin_index'], "", "");
--- 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'] . "
" . sprintf($lang['Click_return_forumadmin'], "", "") . "
" . sprintf($lang['Click_return_admin_index'], "", "");
***************
*** 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'] . "
" . sprintf($lang['Click_return_forumadmin'], "", "") . "
" . sprintf($lang['Click_return_admin_index'], "", "");
--- 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'] . "
" . sprintf($lang['Click_return_forumadmin'], "", "") . "
" . sprintf($lang['Click_return_admin_index'], "", "");
diff --exclude=config.php -crN 2017_base/admin/index.php 2017_ora/admin/index.php
*** 2017_base/admin/index.php Tue Jul 19 21:14:56 2005
--- 2017_ora/admin/index.php Sat Sep 17 15:23:20 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_ora/config.ora_sample.php
*** 2017_base/config.ora_sample.php Thu Jan 1 01:00:00 1970
--- 2017_ora/config.ora_sample.php Sat Sep 17 15:23:20 2005
***************
*** 0 ****
--- 1,18 ----
+
+
diff --exclude=config.php -crN 2017_base/db/oracle.php 2017_ora/db/oracle.php
*** 2017_base/db/oracle.php Thu Jan 1 01:00:00 1970
--- 2017_ora/db/oracle.php Sat Sep 17 15:23:20 2005
***************
*** 0 ****
--- 1,459 ----
+ 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 . "
";
+ echo "Result: $result
";
+ echo "Query ID: $query_id
";
+ echo "
"; + var_dump($result_row); + echo ""; + } + 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_ora/includes/constants.php *** 2017_base/includes/constants.php Tue Jul 19 21:14:56 2005 --- 2017_ora/includes/constants.php Sat Sep 17 15:23:20 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'); diff --exclude=config.php -crN 2017_base/includes/functions_post.php 2017_ora/includes/functions_post.php *** 2017_base/includes/functions_post.php Tue Jul 19 21:14:56 2005 --- 2017_ora/includes/functions_post.php Sat Sep 17 15:23:20 2005 *************** *** 276,286 **** --- 276,297 ---- $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); + } + 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_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject)); *************** *** 289,298 **** // 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 = ''; --- 300,318 ---- // 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++; } --- 350,372 ---- { 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++; } *************** *** 859,862 **** } } ! ?> \ No newline at end of file --- 889,892 ---- } } ! ?> diff --exclude=config.php -crN 2017_base/includes/functions_search.php 2017_ora/includes/functions_search.php *** 2017_base/includes/functions_search.php Tue Jul 19 21:14:56 2005 --- 2017_ora/includes/functions_search.php Sat Sep 17 15:23:20 2005 *************** *** 162,168 **** case 'postgresql': case 'msaccess': case 'mssql-odbc': - case 'oracle': case 'db2': $sql = "SELECT word_id, word_text FROM " . SEARCH_WORD_TABLE . " --- 162,167 ---- *************** *** 201,206 **** --- 200,213 ---- case 'mssql-odbc': $value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "', 0"; break; + case 'oracle': + $sql = "INSERT INTO " . SEARCH_WORD_TABLE_TEMP . " (word_text, word_common, post_id) + VALUES ('" . $word[$i] . "', 0, " . $post_id . ")"; + if( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not insert new temp word', '', __LINE__, __FILE__, $sql); + } + break; default: $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) VALUES ('" . $word[$i] . "', 0)"; *************** *** 213,219 **** } } ! if ( $value_sql != '' ) { switch ( SQL_LAYER ) { --- 220,237 ---- } } ! if (SQL_LAYER == 'oracle') { ! // Get the new words by subtracting old from new ! $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) ! SELECT word_text, word_common FROM " . SEARCH_WORD_TABLE_TEMP . " WHERE post_id = " . $post_id . " ! MINUS ! SELECT word_text, word_common FROM " . SEARCH_WORD_TABLE; ! if( !$db->sql_query($sql) ) ! { ! message_die(GENERAL_ERROR, 'Could not insert new words', '', __LINE__, __FILE__, $sql); ! } ! } ! else if ( $value_sql != '' ) { switch ( SQL_LAYER ) { *************** *** 242,251 **** --- 260,281 ---- if ( $match_sql != '' ) { + switch ( SQL_LAYER ) + { + case 'oracle': + $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, word_common) IN + (SELECT word_text, word_common FROM " . SEARCH_WORD_TABLE_TEMP . " + WHERE post_id = " . $post_id . ") "; + break; + default: $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)"; + break; + } if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql); *************** *** 253,258 **** --- 283,296 ---- } } + if (SQL_LAYER == 'oracle') { + $sql = "DELETE FROM " . SEARCH_WORD_TABLE_TEMP . " WHERE post_id = " . $post_id; + if ( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not delete temp words', '', __LINE__, __FILE__, $sql); + } + } + if ($mode == 'single') { remove_common('single', 4/10, $word); diff --exclude=config.php -crN 2017_base/includes/prune.php 2017_ora/includes/prune.php *** 2017_base/includes/prune.php Tue Jul 19 21:14:56 2005 --- 2017_ora/includes/prune.php Sat Sep 17 15:23:20 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) ) *************** *** 115,120 **** --- 137,152 ---- 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_ora/index.php *** 2017_base/index.php Tue Jul 19 21:14:58 2005 --- 2017_ora/index.php Sat Sep 17 15:23:20 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/posting.php 2017_ora/posting.php *** 2017_base/posting.php Tue Jul 19 21:14:58 2005 --- 2017_ora/posting.php Sat Sep 17 15:23:20 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_ora/privmsg.php *** 2017_base/privmsg.php Tue Jul 19 21:14:58 2005 --- 2017_ora/privmsg.php Sat Sep 17 15:23:20 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_ora/search.php *** 2017_base/search.php Tue Jul 19 21:14:58 2005 --- 2017_ora/search.php Sat Sep 17 15:23:20 2005 *************** *** 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 --- 733,739 ---- { 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 --- 743,749 ---- } 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