[phpMP-CVS] CVS: phpMP/dba mssql.dba,1.1,1.2 mysql.dba,1.23,1.24
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2003-05-17 07:50:20
|
Update of /cvsroot/phpmp/phpMP/dba In directory sc8-pr-cvs1:/tmp/cvs-serv29050/dba Modified Files: mssql.dba mysql.dba Log Message: Added the license notice to each PHP file. No Changelog entry. Index: mssql.dba =================================================================== RCS file: /cvsroot/phpmp/phpMP/dba/mssql.dba,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mssql.dba 15 Feb 2003 00:35:24 -0000 1.1 --- mssql.dba 17 May 2003 07:50:17 -0000 1.2 *************** *** 1,169 **** ! <?php ! ! class DB ! { ! ! var $ident_link; ! var $connected; ! ! function connect() ! { ! if (empty($this->ident_link)) ! { ! $connection = @mssql_connect(DB_HOST, DB_USER, DB_PASSWD); ! ! if (!$connection) ! { ! $this->connected = 0; ! return 0; ! } ! else ! { ! $this->ident_link = $connection; ! ! return $this->ident_link; ! } ! } ! } ! ! function close() ! { ! if ($this->ident_link != 0) ! { ! @mssql_close($this->ident_link); ! $this->ident_link = 0; ! ! return 1; ! } ! else ! { ! return 1; ! } ! } ! ! function query($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $result = @mssql_query($qry, $db); ! return $result; ! } ! } ! ! function numRows($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $num = @mssql_num_rows($qry); ! return $num; ! } ! } ! ! function result($result, $row=0, $field='') ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $return = @mssql_result($result, $row, $field); ! return $return; ! } ! } ! ! function fetchArray($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $result = @mssql_fetch_array($qry); ! return $result; ! } ! } ! ! function fetchRow($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $result = @mssql_fetch_row($qry) ! return $result; ! } ! } ! ! function escapeString($string) ! { ! if( stripslashes($string) == $string ) // Will be true if no slashes were removed. ! { ! addslashes($string); // We'll add the slashes because they haven't already been added. ! return true; ! } ! else // Slashes have already been added (hopefully only once). ! { ! return true; ! } ! } ! ! } ! ! ?> --- 1,191 ---- ! <?php ! ! /* ! * phpMP - The PHP Modular Portal System ! * Copyright (C) 2002-2003 Brian Rose and the phpMP group ! * ! * 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. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! * $Id$ ! * ! */ ! ! class DB ! { ! ! var $ident_link; ! var $connected; ! ! function connect() ! { ! if (empty($this->ident_link)) ! { ! $connection = @mssql_connect(DB_HOST, DB_USER, DB_PASSWD); ! ! if (!$connection) ! { ! $this->connected = 0; ! return 0; ! } ! else ! { ! $this->ident_link = $connection; ! ! return $this->ident_link; ! } ! } ! } ! ! function close() ! { ! if ($this->ident_link != 0) ! { ! @mssql_close($this->ident_link); ! $this->ident_link = 0; ! ! return 1; ! } ! else ! { ! return 1; ! } ! } ! ! function query($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $result = @mssql_query($qry, $db); ! return $result; ! } ! } ! ! function numRows($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $num = @mssql_num_rows($qry); ! return $num; ! } ! } ! ! function result($result, $row=0, $field='') ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $return = @mssql_result($result, $row, $field); ! return $return; ! } ! } ! ! function fetchArray($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $result = @mssql_fetch_array($qry); ! return $result; ! } ! } ! ! function fetchRow($qry) ! { ! if ($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if (!$db) ! { ! return 0; ! } ! else ! { ! $result = @mssql_fetch_row($qry) ! return $result; ! } ! } ! ! function escapeString($string) ! { ! if( stripslashes($string) == $string ) // Will be true if no slashes were removed. ! { ! addslashes($string); // We'll add the slashes because they haven't already been added. ! return true; ! } ! else // Slashes have already been added (hopefully only once). ! { ! return true; ! } ! } ! ! } ! ! ?> Index: mysql.dba =================================================================== RCS file: /cvsroot/phpmp/phpMP/dba/mysql.dba,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** mysql.dba 2 May 2003 04:52:56 -0000 1.23 --- mysql.dba 17 May 2003 07:50:17 -0000 1.24 *************** *** 1,177 **** ! <?php ! ! class DB ! { ! ! var $ident_link; ! var $connected; ! var $query_count; ! ! function connect () ! { ! if ( empty ($this->ident_link) ) ! { ! $connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWD); ! ! if ( !$connection ) ! { ! $this->connected = 0; ! return 0; ! } ! else ! { ! $this->ident_link = $connection; ! ! return $this->ident_link; ! } ! } ! else ! { ! return $this->ident_link; ! } ! ! } ! ! function close () ! { ! if ( $this->ident_link != 0 ) ! { ! @mysql_close($this->ident_link); ! $this->ident_link = 0; ! ! return 1; ! } ! else ! { ! return 1; ! } ! } ! ! function query ( $qry ) ! { ! if ( $this->ident_link == 0 ) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if ( !$db ) ! { ! return 0; ! } ! else ! { ! $result = @mysql_query( $qry, $db ); ! $this->query_count++; ! return $result; ! } ! } ! ! function numRows ($query) ! { ! if ( $this->ident_link == 0 ) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $num = @mysql_num_rows($query); ! return $num; ! ! } ! ! function insertID() ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $num = @mysql_insert_id($this->ident_link); ! return $num; ! ! } ! ! function result ( $result, $row=0, $field='' ) ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $result = @mysql_result($result, $row, $field); ! return $result; ! } ! ! function fetchArray($query) ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! return @mysql_fetch_array($query); ! } ! ! function fetchAssoc($query) ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! return @mysql_fetch_assoc($query); ! } ! ! function fetchRow($query) ! { ! if ( $this->ident_link == 0 ) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $result = @mysql_fetch_row($query); ! return $result; ! } ! ! function affectedRows() { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! return @mysql_affected_rows($db); ! } ! } ! ?> --- 1,199 ---- ! <?php ! ! /* ! * phpMP - The PHP Modular Portal System ! * Copyright (C) 2002-2003 Brian Rose and the phpMP group ! * ! * 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. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! * $Id$ ! * ! */ ! ! class DB ! { ! ! var $ident_link; ! var $connected; ! var $query_count; ! ! function connect () ! { ! if ( empty ($this->ident_link) ) ! { ! $connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWD); ! ! if ( !$connection ) ! { ! $this->connected = 0; ! return 0; ! } ! else ! { ! $this->ident_link = $connection; ! ! return $this->ident_link; ! } ! } ! else ! { ! return $this->ident_link; ! } ! ! } ! ! function close () ! { ! if ( $this->ident_link != 0 ) ! { ! @mysql_close($this->ident_link); ! $this->ident_link = 0; ! ! return 1; ! } ! else ! { ! return 1; ! } ! } ! ! function query ( $qry ) ! { ! if ( $this->ident_link == 0 ) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! if ( !$db ) ! { ! return 0; ! } ! else ! { ! $result = @mysql_query( $qry, $db ); ! $this->query_count++; ! return $result; ! } ! } ! ! function numRows ($query) ! { ! if ( $this->ident_link == 0 ) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $num = @mysql_num_rows($query); ! return $num; ! ! } ! ! function insertID() ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $num = @mysql_insert_id($this->ident_link); ! return $num; ! ! } ! ! function result ( $result, $row=0, $field='' ) ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $result = @mysql_result($result, $row, $field); ! return $result; ! } ! ! function fetchArray($query) ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! return @mysql_fetch_array($query); ! } ! ! function fetchAssoc($query) ! { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! return @mysql_fetch_assoc($query); ! } ! ! function fetchRow($query) ! { ! if ( $this->ident_link == 0 ) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! $result = @mysql_fetch_row($query); ! return $result; ! } ! ! function affectedRows() { ! if($this->ident_link == 0) ! { ! $db = $this->connect(); ! } ! else ! { ! $db = $this->ident_link; ! } ! ! return @mysql_affected_rows($db); ! } ! } ! ?> |