Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
@@ -2,15 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Board v1.1
|
||||
| Invision Power Board v1.3 Final
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001,2002 Invision Power Services
|
||||
| http://www.ibforums.com
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
| Web: http://www.invisionboard.com
|
||||
| Time: Sun, 04 Jan 2004 00:30:16 GMT
|
||||
| Release: 28e7bfb25f08ac72a789cb1b172fa185
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > mySQL DB abstraction module
|
||||
@@ -42,6 +44,7 @@ class db_driver {
|
||||
var $record_row = array();
|
||||
var $return_die = 0;
|
||||
var $error = "";
|
||||
var $failed = 0;
|
||||
|
||||
/*========================================================================*/
|
||||
// Connect to the database
|
||||
@@ -76,15 +79,18 @@ class db_driver {
|
||||
// Process a query
|
||||
/*========================================================================*/
|
||||
|
||||
function query($the_query) {
|
||||
function query($the_query, $bypass=0) {
|
||||
|
||||
//--------------------------------------
|
||||
// Change the table prefix if needed
|
||||
//--------------------------------------
|
||||
|
||||
if ($this->obj['sql_tbl_prefix'] != "ibf_")
|
||||
if ($bypass != 1)
|
||||
{
|
||||
$the_query = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $this->obj['sql_tbl_prefix']."\\1\\2", $the_query);
|
||||
if ($this->obj['sql_tbl_prefix'] != "ibf_")
|
||||
{
|
||||
$the_query = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $this->obj['sql_tbl_prefix']."\\1\\2", $the_query);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->obj['debug'])
|
||||
@@ -113,7 +119,7 @@ class db_driver {
|
||||
<td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>Select Query</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='8' style='font-family:courier new, courier, monaco, arial;font-size:14px'>$the_query</td>
|
||||
<td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>$the_query</td>
|
||||
</tr>
|
||||
<tr bgcolor='#FFC5Cb'>
|
||||
<td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>
|
||||
@@ -162,7 +168,7 @@ class db_driver {
|
||||
<td style='font-size:14px' bgcolor='#EFEFEF'><b>Non Select Query</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='font-family:courier new, courier, monaco, arial;font-size:14px'>$the_query</td>
|
||||
<td style='font-family:courier, monaco, arial;font-size:14px'>$the_query</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='font-size:14px' bgcolor='#EFEFEF'><b>mySQL time</b>: $endtime</span></td>
|
||||
@@ -300,15 +306,17 @@ class db_driver {
|
||||
|
||||
if ($this->return_die == 1)
|
||||
{
|
||||
$this->error = mysql_error();
|
||||
return TRUE;
|
||||
$this->error = mysql_error();
|
||||
$this->error_no = mysql_errno();
|
||||
$this->failed = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
$the_error .= "\n\nmySQL error: ".mysql_error()."\n";
|
||||
$the_error .= "mySQL error code: ".mysql_errno()."\n";
|
||||
$the_error .= "mySQL error code: ".$this->error_no."\n";
|
||||
$the_error .= "Date: ".date("l dS of F Y h:i:s A");
|
||||
|
||||
$out = "<html><head><title>Invision Board Database Error</title>
|
||||
$out = "<html><head><title>Invision Power Board Database Error</title>
|
||||
<style>P,BODY{ font-family:arial,sans-serif; font-size:11px; }</style></head><body>
|
||||
<br><br><blockquote><b>There appears to be an error with the {$INFO['board_name']} database.</b><br>
|
||||
You can try to refresh the page by clicking <a href=\"javascript:window.location=window.location;\">here</a>, if this
|
||||
@@ -332,7 +340,8 @@ class db_driver {
|
||||
$field_names = "";
|
||||
$field_values = "";
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
foreach ($data as $k => $v)
|
||||
{
|
||||
$v = preg_replace( "/'/", "\\'", $v );
|
||||
//$v = preg_replace( "/#/", "\\#", $v );
|
||||
$field_names .= "$k,";
|
||||
@@ -357,7 +366,8 @@ class db_driver {
|
||||
|
||||
$return_string = "";
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
foreach ($data as $k => $v)
|
||||
{
|
||||
$v = preg_replace( "/'/", "\\'", $v );
|
||||
$return_string .= $k . "='".$v."',";
|
||||
}
|
||||
@@ -366,6 +376,36 @@ class db_driver {
|
||||
|
||||
return $return_string;
|
||||
}
|
||||
|
||||
/*========================================================================*/
|
||||
// Test to see if a field exists by forcing and trapping an error.
|
||||
// It ain't pretty, but it do the job don't it, eh?
|
||||
// Posh my ass.
|
||||
// Return 1 for exists, 0 for not exists and jello for the naked guy
|
||||
// Fun fact: The number of times I spelt 'field' as 'feild'in this part: 104
|
||||
/*========================================================================*/
|
||||
|
||||
function field_exists($field, $table) {
|
||||
|
||||
$this->return_die = 1;
|
||||
$this->error = "";
|
||||
|
||||
$this->query("SELECT COUNT($field) as count FROM $table");
|
||||
|
||||
$return = 1;
|
||||
|
||||
if ( $this->failed )
|
||||
{
|
||||
$return = 0;
|
||||
}
|
||||
|
||||
$this->error = "";
|
||||
$this->return_die = 0;
|
||||
$this->error_no = 0;
|
||||
$this->failed = 0;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
} // end class
|
||||
|
||||
|
||||
Reference in new issue
Block a user