phpmp-commits Mailing List for phpMyPublications
Status: Pre-Alpha
Brought to you by:
heimidal
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(69) |
May
(1) |
Jun
|
Jul
(53) |
Aug
(27) |
Sep
|
Oct
|
Nov
(35) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
(65) |
Mar
|
Apr
(15) |
May
(40) |
Jun
(72) |
Jul
|
Aug
(2) |
Sep
(95) |
Oct
(37) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Brian R. <hei...@us...> - 2005-02-07 23:29:10
|
Update of /cvsroot/phpmp/phpMyPublications In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23739 Added Files: config.php Log Message: Adding config.php to the mix. --- NEW FILE: config.php --- |
From: Brian R. <hei...@us...> - 2005-02-07 23:26:37
|
Update of /cvsroot/phpmp/phpMyPublications/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23037/includes Modified Files: common.php Log Message: A few additions that weren't in the initial commit. |
From: Brian R. <hei...@us...> - 2005-02-07 23:26:37
|
Update of /cvsroot/phpmp/phpMyPublications/includes/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23037/includes/db Modified Files: mysql.php Log Message: A few additions that weren't in the initial commit. Index: mysql.php =================================================================== RCS file: /cvsroot/phpmp/phpMyPublications/includes/db/mysql.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** mysql.php 7 Feb 2005 23:13:39 -0000 1.1.1.1 --- mysql.php 7 Feb 2005 23:26:29 -0000 1.2 *************** *** 11,28 **** // $Id$ // ! // FILE NAME: mysql.php ! // START DATE: Feb 7, 2005 // // --------------------------------------------------------------- ! if(! defined('IN_PHPMP') ) { - die('Hacking attempt.'); - } ! include($phpmp_root_path . 'config.php'); ! include($phpmp_root_path . 'includes/db/' . $db_type . '.php'); ! $db = new sql_db(); ?> \ No newline at end of file --- 11,78 ---- // $Id$ // ! // FILE NAME : mysql.php ! // START DATE : Feb 7, 2005 ! // ! // // // --------------------------------------------------------------- ! class db { ! var $connection_id; ! var $result; ! var $num_queries = 0; ! var $queries = array(); ! ! connect($host, $user, $password, $database, $port = false) ! { ! $this->host = $host; ! $this->user = $user; ! $this->password = $password; ! $this->database = $database; ! $this-port = $port; ! ! $this->connection_id = @mysql_connect($host . (($port) ? ':' . $port : ''), $user, $password); ! ! if($this->connection_id && ($database != '')) ! { ! if(@mysql_select_db($database)) ! { ! return $this->connection_id; ! } ! } ! ! return error(true); ! } ! ! query($sql) ! { ! $query = @mysql_query($sql, $this->connection_id); ! if($query != 0) ! { ! $this->num_queries++; ! $queries[] = $query; ! return $query; ! } ! ! return false; ! } ! ! error($fatal = false, $sql = '') ! { ! if($fatal) ! { ! $error = 'A fatal error occurred while accessing the database.<br /><br /><b>ERROR:</b> ' . @mysql_error; ! $error .= ($sql != '') ? '<br /><br />b>SQL:</b> ' . $sql : ''; ! ! trigger_error($error); ! } ! ! return array('error' => @mysql_error(), 'code' => @mysql_errno()); ! } ! ! } ?> \ No newline at end of file |
From: Brian R. <hei...@us...> - 2005-02-07 23:13:50
|
Update of /cvsroot/phpmp/phpMyPublications In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18789 Log Message: Initial import. Status: Vendor Tag: vendor Release Tags: start N phpMyPublications/index.php N phpMyPublications/includes/common.php N phpMyPublications/includes/db/mysql.php No conflicts created by this import ***** Bogus filespec: - ***** Bogus filespec: Imported ***** Bogus filespec: sources |
From: Adam A. <ra...@us...> - 2003-10-15 04:38:34
|
Update of /cvsroot/phpmp/phpMP/language In directory sc8-pr-cvs1:/tmp/cvs-serv7228/language Added Files: index.html Log Message: Just an example |
From: Adam A. <ra...@us...> - 2003-10-15 04:38:34
|
Update of /cvsroot/phpmp/phpMP/language/en In directory sc8-pr-cvs1:/tmp/cvs-serv7228/language/en Added Files: general.php index.html Log Message: Just an example --- NEW FILE: general.php --- <?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: general.php,v 1.1 2003/10/15 04:38:27 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // English Language (US/UK) // Database Specific $lang = array( 'CONNECTION_NOT_ESTABLED' => 'phpMP was unable to establish a database connection'; 'DATABASE_NOT_SELECTED' => 'phpMP was unable to select the required database'; ); ?> |
From: Adam A. <ra...@us...> - 2003-10-15 04:25:36
|
Update of /cvsroot/phpmp/phpMP/includes/db In directory sc8-pr-cvs1:/tmp/cvs-serv4647/includes/db Modified Files: mysql.php postgresql.php Log Message: Some new files (just framework for error handling) Index: mysql.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/db/mysql.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mysql.php 15 Oct 2003 03:53:09 -0000 1.2 --- mysql.php 15 Oct 2003 04:25:33 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- <?php + /* * phpMP - The PHP Modular Portal System *************** *** 132,136 **** if( !is_null($sql_explain) ) { ! $this->error_handler->sql_error($sql_explain, $line, $file, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else --- 133,137 ---- if( !is_null($sql_explain) ) { ! $this->error_handler->sql_error($this->db_query, $sql_explain, $line, $file, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else Index: postgresql.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/db/postgresql.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** postgresql.php 15 Oct 2003 03:53:09 -0000 1.2 --- postgresql.php 15 Oct 2003 04:25:33 -0000 1.3 *************** *** 109,113 **** if( !is_null($sql_explain) ) { ! $this->error_handler->sql_error($sql_explain, $line, $file, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else --- 109,113 ---- if( !is_null($sql_explain) ) { ! $this->error_handler->sql_error($this->db_query, $sql_explain, $line, $file, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else |
From: Adam A. <ra...@us...> - 2003-10-15 04:25:36
|
Update of /cvsroot/phpmp/phpMP/includes In directory sc8-pr-cvs1:/tmp/cvs-serv4647/includes Added Files: common.php error_handler.php functions.php Log Message: Some new files (just framework for error handling) --- NEW FILE: common.php --- <?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: common.php,v 1.1 2003/10/15 04:25:33 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // Get PHP start microtime $php_start = explode(' ', microtime()); // Only report Core and Parse errors with Serious warnings error_reporting(E_ERROR | E_WARNING | E_PARSE); // Disable magic quotes runtime set_magic_quotes_runtime(0); // Good idea from phpBB 2.2, unset all vars incase // register globals was on. Lazy programmers, start using // superglobals, $_GET, $_POST, $_COOKIE, $_SERVER and $_FILES if (@ini_get('register_globals')) { foreach ($_REQUEST as $var_name => $void) { unset(${$var_name}); } } // Initialise language variable $lang = array(); // Include error handling class include(PHPMP_ROOT.INCLUDES_DIR.'error_handler'.PHP_EXT); $error_handler = new error_handler(&$lang); // Because we cannot pass an object to the set_error_handler function // (not until 4.3.0, we will have a dummy function pass things for us) function php_error_handler($errno, $msg_text, $errfile, $errline) { // I don't like using global, but we have no choice here global $error_handler; $error_handler->php_error($errno, $msg_text, $errfile, $errline); } // Include general functions include(PHPMP_ROOT.INCLUDES_DIR.'functions'.PHP_EXT); // We want all inputted data automatically slashed. If magic_quotes_gpc // is set (another phpBB 2.2 inspiration) if ( !get_magic_quotes_gpc() ) { $_COOKIE = addlashes_array($_COOKIE); $_GET = addlashes_array($_GET); $_POST = addlashes_array($_POST); } ?> --- NEW FILE: error_handler.php --- <?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: error_handler.php,v 1.1 2003/10/15 04:25:33 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // PHP and Customer Error handling class class error_handler { var $lang; // Constructor function error_handler($lang) { $this->lang = $lang; } // Errors generated by PHP parse or trigger_error function php_error($errno, $msg_text, $errfile, $errline) { echo '<pre> '.$errno.' '.$msg_text.' '.$errfile.' '.$errline.' </pre>'; die; } function db_error($explain, $error_message, $error_no) { echo '<pre> '.$explain.' '.$error_message.' '.$error_number.' </pre>'; die; } function sql_error($sql, $sql_explain = '', $line = NULL, $file = NULL, $error_message = '', $error_number = NULL) { echo '<pre> '.$sql.' '.$sql_explain.' '.$line.' '.$file.' '.$error_message.' '.$error_number.' </pre>'; die; } } ?> |
From: Adam A. <ra...@us...> - 2003-10-15 03:53:13
|
Update of /cvsroot/phpmp/phpMP/includes/db In directory sc8-pr-cvs1:/tmp/cvs-serv32004/includes/db Modified Files: mysql.php postgresql.php Log Message: Error handling.. Index: mysql.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/db/mysql.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mysql.php 15 Oct 2003 03:37:24 -0000 1.1 --- mysql.php 15 Oct 2003 03:53:09 -0000 1.2 *************** *** 31,39 **** class sql_db { ! var $db_connection_id; ! var $db_query; ! var $db_query_result = 0; ! var $db_query_count = 0; ! var $db_rowset = array(); // Open database connection, select database --- 31,48 ---- class sql_db { ! var $db_connection_id; // Database connection resource id ! var $db_query; // SQL ! var $db_query_result = 0; // Result resource id ! var $db_query_count = 0; // Total query count ! var $db_rowset = array(); // Selected rows ! var $lang; // Reference to big language variable ! var $error_handler; // Reference to error handling class ! ! // Class constructor ! function sql_db($lang, $error_handler) ! { ! $this->lang = $lang; ! $this->error_handler = $error_handler; ! } // Open database connection, select database *************** *** 54,58 **** if( !is_null($error_handling) ) { ! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else --- 63,67 ---- if( !is_null($error_handling) ) { ! $this->error_handler->db_error($lang['CONNECTION_NOT_ESTABLISHED'], $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else *************** *** 69,73 **** if( !is_null($error_handling) ) { ! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else --- 78,82 ---- if( !is_null($error_handling) ) { ! $this->error_handler->db_error($lang['DATABASE_NOT_SELECTED'], $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else *************** *** 123,127 **** if( !is_null($sql_explain) ) { ! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file); } else --- 132,136 ---- if( !is_null($sql_explain) ) { ! $this->error_handler->sql_error($sql_explain, $line, $file, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else Index: postgresql.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/db/postgresql.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** postgresql.php 15 Oct 2003 03:37:24 -0000 1.1 --- postgresql.php 15 Oct 2003 03:53:09 -0000 1.2 *************** *** 32,40 **** class sql_db { ! var $db_connection_id; ! var $db_query; ! var $db_query_result = 0; ! var $db_query_count = 0; ! var $db_rowset = array(); // Open database connection, select database --- 32,42 ---- class sql_db { ! var $db_connection_id; // Database connection resource id ! var $db_query; // SQL ! var $db_query_result = 0; // Result resource id ! var $db_query_count = 0; // Total query count ! var $db_rowset = array(); // Selected rows ! var $lang; // Reference to big language variable ! var $error_handler; // Reference to error handling class // Open database connection, select database *************** *** 54,58 **** if( !is_null($error_handling) ) { ! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), NULL); } else --- 56,60 ---- if( !is_null($error_handling) ) { ! $this->error_handler->db_error($lang['CONNECTION_NOT_ESTABLISHED'], $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else *************** *** 107,111 **** if( !is_null($sql_explain) ) { ! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file); } else --- 109,113 ---- if( !is_null($sql_explain) ) { ! $this->error_handler->sql_error($sql_explain, $line, $file, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else |
From: Adam A. <ra...@us...> - 2003-10-15 03:38:19
|
Update of /cvsroot/phpmp/phpMP/admin/db In directory sc8-pr-cvs1:/tmp/cvs-serv29741/admin/db Removed Files: index.html mysql.php postgresql.php Log Message: Should be alright now.. --- index.html DELETED --- --- mysql.php DELETED --- --- postgresql.php DELETED --- |
From: Adam A. <ra...@us...> - 2003-10-15 03:37:29
|
Update of /cvsroot/phpmp/phpMP/includes/db In directory sc8-pr-cvs1:/tmp/cvs-serv29617/includes/db Added Files: index.html mysql.php postgresql.php Log Message: Should be alright now.. --- NEW FILE: index.html --- --- NEW FILE: mysql.php --- <?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: mysql.php,v 1.1 2003/10/15 03:37:24 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // MySQL 3.x/4.0 Database API class sql_db { var $db_connection_id; var $db_query; var $db_query_result = 0; var $db_query_count = 0; var $db_rowset = array(); // Open database connection, select database function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL ) { if( !is_null($this->persistant) ) { $this->db_connection_id = @mysql_pconnect($host, $username, $password); } else { $this->db_connection_id = @mysql_connect($host, $username, $password); } if( !$this->db_connection_id ) { if( !is_null($error_handling) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else { return false; } } else { $db_select = @mysql_select_db($database, $this->db_connection_id); if( !$db_select ) { if( !is_null($error_handling) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else { return false; } } return $this->db_connection_id; } } function sql_close($db_connect_id = NULL) { if( is_null($db_connect_id) ) { $db_connect_id = $this->db_connection_id; } if($db_connect_id != FALSE) { if($this->db_query_result) { @$this->sql_free_result($this->db_query_result); } return @mysql_close($db_connect_id); } } // Query database // If you pass no query, it will try to execute the last query again function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL ) { $this->sql_free_result($this->db_query_result); // remove previous query result if( !empty($sql) ) { $this->db_query = $sql; } $this->db_query_count++; $this->db_query_result = @mysql_query($this->db_query, $this->db_connection_id); if( $this->db_query_result) { unset($this->db_rowset[$this->db_query_result]); return $this->db_query_result; } else { if( !is_null($sql_explain) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file); } else { return false; } } } // Select a row as an Associative, Numeric or Both (array) function sql_fetch_row($db_query_id = NULL, $row = NULL, $type = MYSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_fetch_array($db_query_id, $type); } // Select all rows in one big array function sql_fetch_rowset($db_query_id = NULL, $type = MYSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$this->db_query_result]); $this->db_rowset[$this->db_query_result] = Array(); while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) ) { $this->db_rowset[$this->db_query_result][] = $row; } return $this->db_rowset[$this->db_query_result]; } // Number of rows from the last select query. Shouldn't be used for // Firebird compatability (hopefully an ibase_num_rows function will // be soon) function sql_num_rows($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_num_rows($db_query_id); } // Get last ID generated from an INSERT query function sql_insert_id($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_insert_id($this->db_connection_id); } // Free result resource function sql_free_result($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$db_query_id]); return @mysql_free_result($db_query_id); } // Number of fields selected in last query function sql_num_fields($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_num_fields($db_query_id); } // Name of a specific field from a result function sql_field_name($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_field_name($db_query_id, $field_offset); } // Field type from a result function sql_field_type($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_field_type($db_query_id, $field_offset); } // Amount of rows affected in last query function sql_affected_rows() { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_affected_rows($this->db_connection_id); } // SQL Error message from connection function sql_error($db_connection_id = NULL) { if( is_null($db_connection_id) ) { $db_connection_id = $this->db_connect_id; } return @mysql_error($db_connection_id); } // SQL Error number from connection function sql_errno($db_connection_id = NULL) { if( is_null($db_connection_id) ) { $db_connection_id = $this->db_connect_id; } return @mysql_errno($db_connection_id); } } // End of sql_db ?> --- NEW FILE: postgresql.php --- <?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: postgresql.php,v 1.1 2003/10/15 03:37:24 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // PostgreSQL 7.x Database API class sql_db { var $db_connection_id; var $db_query; var $db_query_result = 0; var $db_query_count = 0; var $db_rowset = array(); // Open database connection, select database function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL ) { if( !is_null($this->persistant) ) { $this->db_connection_id = pg_pconnect("host=$hostname port=$port user=$username password=$password dbname=$database"); } else { $this->db_connection_id = pg_connect("host=$hostname port=$port user=$username password=$password dbname=$database"); } if( !$this->db_connection_id ) { if( !is_null($error_handling) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), NULL); } else { return false; } } return $this->db_connection_id; } function sql_close($db_connect_id = NULL) { if( is_null($db_connect_id) ) { $db_connect_id = $this->db_connection_id; } if($db_connect_id != FALSE) { if($this->db_query_result) { $this->sql_free_result($this->db_query_result); } return @pg_close($db_connect_id); } } // Query database // If you pass no query, it will try to execute the last query again function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL ) { $this->sql_free_result($this->db_query_result); // remove previous query result if( !empty($sql) ) { $this->db_query = $sql; } $this->db_query_count++; $this->db_query_result = @pg_exec($this->db_query, $this->db_connection_id); if( $this->db_query_result) { unset($this->db_rowset[$this->db_query_result]); return $this->db_query_result; } else { if( !is_null($sql_explain) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file); } else { return false; } } } // Select a row as an Associative, Numeric or Both (array) function sql_fetch_row($db_query_id = NULL, $row_number = NULL, $type = PGSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } if ( !is_null($row_number) ) { return @pg_fetch_array($db_query_id, $row_number, $type); } else { return @pg_fetch_array($db_query_id); } } // Select all rows in one big array function sql_fetch_rowset($db_query_id = NULL, $type = PGSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$this->db_query_result]); $this->db_rowset[$this->db_query_result] = Array(); while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) ) { $this->db_rowset[$this->db_query_result][] = $row; } return $this->db_rowset[$this->db_query_result]; } // Number of rows from the last select query. Shouldn't be used for // Firebird compatability (hopefully an ibase_num_rows function will // be soon) function sql_num_rows($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_numrows($db_query_id); } // Get last ID generated from an INSERT query // We will base this ID on the last query. The only way this function // to work is to execute this right after you run the INSERT query. function sql_insert_id($db_query_id = NULL) { // Regex used from phpBB 2.0.x if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->db_query, $tablename) ) { $sequence_result = $this->sql_query("SELECT currval('".$tablename[1]."_seq') AS last_id"); if( !$sequence_data ) { return false; } $sequence_data = $this->sql_fetch_row($sequence_result, 0, PGSQL_ASSOC); if( $sequence_data ) { return $sequence_data['last_id']; } } return false; } // Free result resource function sql_free_result($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$db_query_id]); return @pg_freeresult($db_query_id); } // Number of fields selected in last query function sql_num_fields($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_numfields($db_query_id); } // Name of a specific field from a result function sql_field_name($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_fieldname($db_query_id, $field_offset); } // Field type from a result function sql_field_type($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_fieldtype($db_query_id, $field_offset); } // Amount of rows affected in last query function sql_affected_rows() { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_cmdtuples($this->db_connection_id); } // SQL Error message from connection function sql_error($db_connection_id = NULL) { if( is_null($db_connection_id) ) { $db_connection_id = $this->db_connect_id; } return @pg_errormessage($db_connection_id); } // Attempt to get PostgreSQL Error code // Blame me (R45) if this fails function sql_errno($connection = NULL) { if( is_null($connection) ) { $connection = $this->db_connection_id; } // With postgres, there is no unified error number system. We will need // to get the number based on the message // We'll get the last message here, feel free to adjust this Booster // if you want it as an object variable created elsewhere $last_error = $this->sql_error($connection); // So we don't have to set the error messages again static $pgsql_errors; // If we didn't do this before if( empty($pgsql_errors) ) { // This is an array of error messages that PostgreSQL has error numbers for $pgsql_errors = Array( '/Out of memory in line [0-9]+/' => -12, '/Data not found line [0-9]+/' => -100, '/Unsupported type .* on line ([0-9])+/' => -200, '/Too many arguments line [0-9]+/' => -201, '/Too few arguments line [0-9]+/' => -202, '/Too many matches line [0-9]+/' => -203, '/Not correctly formatted int type: .* line [0-9]+/' => -204, '/Not correctly formatted unsigned type: .* line [0-9]+/' => -205, '/Not correctly formatted floating-point type: .* line [0-9]+/' => -206, '/Unable to convert .* to bool on line [0-9]+/' => -207, '/Empty query line [0-9]+/' => -208, '/NULL value without indicator in line [0-9]+/' => -209, '/Variable is not an array in line [0-9]+/' => -210, '/Data read from backend is not an array in line [0-9]+/' => -211, '/No such connection .* in line [0-9]+/' => -220, '/Not connected in line [0-9]+/' => -221, '/Invalid statement name .* in line [0-9]+/' => -230, '/Descriptor .* not found in line [0-9]+/' => -240, '/Descriptor index out of range in line [0-9]+/' => -241, '/Descriptor .* not found in line [0-9]+/' => -242, '/Variable is not a numeric type in line [0-9]+/' => -243, '/Variable is not a character type in line [0-9]+/' => -244, '/Postgres error: .* line [0-9]+/' => -400, '/Error in transaction processing line [0-9]+/' => -401, '/Could not connect to database .* in line [0-9]+/' => -402, ); } // Lets juggle the error messages foreach ($pgsql_errors as $error => $number) { if( preg_match($error, $last_error)) { // return appropriate number for this error return $number; } } // No error number exists, so 0 will do return NULL; } } // End of sql_db ?> |
From: Adam A. <ra...@us...> - 2003-10-15 03:37:29
|
Update of /cvsroot/phpmp/phpMP/includes In directory sc8-pr-cvs1:/tmp/cvs-serv29617/includes Added Files: index.html Log Message: Should be alright now.. |
From: Adam A. <ra...@us...> - 2003-10-15 03:36:38
|
Update of /cvsroot/phpmp/phpMP/includes/db In directory sc8-pr-cvs1:/tmp/cvs-serv29512/db Log Message: Directory /cvsroot/phpmp/phpMP/includes/db added to the repository |
From: Adam A. <ra...@us...> - 2003-10-15 03:30:16
|
Update of /cvsroot/phpmp/phpMP/admin/db In directory sc8-pr-cvs1:/tmp/cvs-serv28599/core/db Added Files: index.html mysql.php postgresql.php Log Message: Fresh start... --- NEW FILE: index.html --- --- NEW FILE: mysql.php --- <?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: mysql.php,v 1.1 2003/10/15 03:30:10 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // MySQL 3.x/4.0 Database API class sql_db { var $db_connection_id; var $db_query; var $db_query_result = 0; var $db_query_count = 0; var $db_rowset = array(); // Open database connection, select database function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL ) { if( !is_null($this->persistant) ) { $this->db_connection_id = @mysql_pconnect($host, $username, $password); } else { $this->db_connection_id = @mysql_connect($host, $username, $password); } if( !$this->db_connection_id ) { if( !is_null($error_handling) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else { return false; } } else { $db_select = @mysql_select_db($database, $this->db_connection_id); if( !$db_select ) { if( !is_null($error_handling) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id)); } else { return false; } } return $this->db_connection_id; } } function sql_close($db_connect_id = NULL) { if( is_null($db_connect_id) ) { $db_connect_id = $this->db_connection_id; } if($db_connect_id != FALSE) { if($this->db_query_result) { @$this->sql_free_result($this->db_query_result); } return @mysql_close($db_connect_id); } } // Query database // If you pass no query, it will try to execute the last query again function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL ) { $this->sql_free_result($this->db_query_result); // remove previous query result if( !empty($sql) ) { $this->db_query = $sql; } $this->db_query_count++; $this->db_query_result = @mysql_query($this->db_query, $this->db_connection_id); if( $this->db_query_result) { unset($this->db_rowset[$this->db_query_result]); return $this->db_query_result; } else { if( !is_null($sql_explain) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file); } else { return false; } } } // Select a row as an Associative, Numeric or Both (array) function sql_fetch_row($db_query_id = NULL, $row = NULL, $type = MYSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_fetch_array($db_query_id, $type); } // Select all rows in one big array function sql_fetch_rowset($db_query_id = NULL, $type = MYSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$this->db_query_result]); $this->db_rowset[$this->db_query_result] = Array(); while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) ) { $this->db_rowset[$this->db_query_result][] = $row; } return $this->db_rowset[$this->db_query_result]; } // Number of rows from the last select query. Shouldn't be used for // Firebird compatability (hopefully an ibase_num_rows function will // be soon) function sql_num_rows($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_num_rows($db_query_id); } // Get last ID generated from an INSERT query function sql_insert_id($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_insert_id($this->db_connection_id); } // Free result resource function sql_free_result($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$db_query_id]); return @mysql_free_result($db_query_id); } // Number of fields selected in last query function sql_num_fields($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_num_fields($db_query_id); } // Name of a specific field from a result function sql_field_name($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_field_name($db_query_id, $field_offset); } // Field type from a result function sql_field_type($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_field_type($db_query_id, $field_offset); } // Amount of rows affected in last query function sql_affected_rows() { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @mysql_affected_rows($this->db_connection_id); } // SQL Error message from connection function sql_error($db_connection_id = NULL) { if( is_null($db_connection_id) ) { $db_connection_id = $this->db_connect_id; } return @mysql_error($db_connection_id); } // SQL Error number from connection function sql_errno($db_connection_id = NULL) { if( is_null($db_connection_id) ) { $db_connection_id = $this->db_connect_id; } return @mysql_errno($db_connection_id); } } // End of sql_db ?> --- NEW FILE: postgresql.php --- <?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: postgresql.php,v 1.1 2003/10/15 03:30:10 rasadam Exp $ * */ if(!defined('PHPMP')) { die; } // PostgreSQL 7.x Database API class sql_db { var $db_connection_id; var $db_query; var $db_query_result = 0; var $db_query_count = 0; var $db_rowset = array(); // Open database connection, select database function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL ) { if( !is_null($this->persistant) ) { $this->db_connection_id = pg_pconnect("host=$hostname port=$port user=$username password=$password dbname=$database"); } else { $this->db_connection_id = pg_connect("host=$hostname port=$port user=$username password=$password dbname=$database"); } if( !$this->db_connection_id ) { if( !is_null($error_handling) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), NULL); } else { return false; } } return $this->db_connection_id; } function sql_close($db_connect_id = NULL) { if( is_null($db_connect_id) ) { $db_connect_id = $this->db_connection_id; } if($db_connect_id != FALSE) { if($this->db_query_result) { $this->sql_free_result($this->db_query_result); } return @pg_close($db_connect_id); } } // Query database // If you pass no query, it will try to execute the last query again function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL ) { $this->sql_free_result($this->db_query_result); // remove previous query result if( !empty($sql) ) { $this->db_query = $sql; } $this->db_query_count++; $this->db_query_result = @pg_exec($this->db_query, $this->db_connection_id); if( $this->db_query_result) { unset($this->db_rowset[$this->db_query_result]); return $this->db_query_result; } else { if( !is_null($sql_explain) ) { // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file); } else { return false; } } } // Select a row as an Associative, Numeric or Both (array) function sql_fetch_row($db_query_id = NULL, $row_number = NULL, $type = PGSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } if ( !is_null($row_number) ) { return @pg_fetch_array($db_query_id, $row_number, $type); } else { return @pg_fetch_array($db_query_id); } } // Select all rows in one big array function sql_fetch_rowset($db_query_id = NULL, $type = PGSQL_BOTH) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$this->db_query_result]); $this->db_rowset[$this->db_query_result] = Array(); while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) ) { $this->db_rowset[$this->db_query_result][] = $row; } return $this->db_rowset[$this->db_query_result]; } // Number of rows from the last select query. Shouldn't be used for // Firebird compatability (hopefully an ibase_num_rows function will // be soon) function sql_num_rows($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_numrows($db_query_id); } // Get last ID generated from an INSERT query // We will base this ID on the last query. The only way this function // to work is to execute this right after you run the INSERT query. function sql_insert_id($db_query_id = NULL) { // Regex used from phpBB 2.0.x if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->db_query, $tablename) ) { $sequence_result = $this->sql_query("SELECT currval('".$tablename[1]."_seq') AS last_id"); if( !$sequence_data ) { return false; } $sequence_data = $this->sql_fetch_row($sequence_result, 0, PGSQL_ASSOC); if( $sequence_data ) { return $sequence_data['last_id']; } } return false; } // Free result resource function sql_free_result($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } unset($this->db_rowset[$db_query_id]); return @pg_freeresult($db_query_id); } // Number of fields selected in last query function sql_num_fields($db_query_id = NULL) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_numfields($db_query_id); } // Name of a specific field from a result function sql_field_name($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_fieldname($db_query_id, $field_offset); } // Field type from a result function sql_field_type($db_query_id = NULL, $field_offset) { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_fieldtype($db_query_id, $field_offset); } // Amount of rows affected in last query function sql_affected_rows() { if( is_null($db_query_id) ) { $db_query_id = $this->db_query_result; } return @pg_cmdtuples($this->db_connection_id); } // SQL Error message from connection function sql_error($db_connection_id = NULL) { if( is_null($db_connection_id) ) { $db_connection_id = $this->db_connect_id; } return @pg_errormessage($db_connection_id); } // Attempt to get PostgreSQL Error code // Blame me (R45) if this fails function sql_errno($connection = NULL) { if( is_null($connection) ) { $connection = $this->db_connection_id; } // With postgres, there is no unified error number system. We will need // to get the number based on the message // We'll get the last message here, feel free to adjust this Booster // if you want it as an object variable created elsewhere $last_error = $this->sql_error($connection); // So we don't have to set the error messages again static $pgsql_errors; // If we didn't do this before if( empty($pgsql_errors) ) { // This is an array of error messages that PostgreSQL has error numbers for $pgsql_errors = Array( '/Out of memory in line [0-9]+/' => -12, '/Data not found line [0-9]+/' => -100, '/Unsupported type .* on line ([0-9])+/' => -200, '/Too many arguments line [0-9]+/' => -201, '/Too few arguments line [0-9]+/' => -202, '/Too many matches line [0-9]+/' => -203, '/Not correctly formatted int type: .* line [0-9]+/' => -204, '/Not correctly formatted unsigned type: .* line [0-9]+/' => -205, '/Not correctly formatted floating-point type: .* line [0-9]+/' => -206, '/Unable to convert .* to bool on line [0-9]+/' => -207, '/Empty query line [0-9]+/' => -208, '/NULL value without indicator in line [0-9]+/' => -209, '/Variable is not an array in line [0-9]+/' => -210, '/Data read from backend is not an array in line [0-9]+/' => -211, '/No such connection .* in line [0-9]+/' => -220, '/Not connected in line [0-9]+/' => -221, '/Invalid statement name .* in line [0-9]+/' => -230, '/Descriptor .* not found in line [0-9]+/' => -240, '/Descriptor index out of range in line [0-9]+/' => -241, '/Descriptor .* not found in line [0-9]+/' => -242, '/Variable is not a numeric type in line [0-9]+/' => -243, '/Variable is not a character type in line [0-9]+/' => -244, '/Postgres error: .* line [0-9]+/' => -400, '/Error in transaction processing line [0-9]+/' => -401, '/Could not connect to database .* in line [0-9]+/' => -402, ); } // Lets juggle the error messages foreach ($pgsql_errors as $error => $number) { if( preg_match($error, $last_error)) { // return appropriate number for this error return $number; } } // No error number exists, so 0 will do return NULL; } } // End of sql_db ?> |
From: Adam A. <ra...@us...> - 2003-10-15 03:29:39
|
Update of /cvsroot/phpmp/phpMP/templates In directory sc8-pr-cvs1:/tmp/cvs-serv28473/templates Added Files: index.html Log Message: Fresh start... |
From: Adam A. <ra...@us...> - 2003-10-15 03:29:39
|
Update of /cvsroot/phpmp/phpMP/install/schemas In directory sc8-pr-cvs1:/tmp/cvs-serv28473/install/schemas Added Files: index.html Log Message: Fresh start... --- NEW FILE: index.html --- |
From: Adam A. <ra...@us...> - 2003-10-15 03:29:38
|
Update of /cvsroot/phpmp/phpMP/admin In directory sc8-pr-cvs1:/tmp/cvs-serv28473/admin Added Files: index.html Log Message: Fresh start... |
From: Adam A. <ra...@us...> - 2003-10-15 03:29:38
|
Update of /cvsroot/phpmp/phpMP/modules In directory sc8-pr-cvs1:/tmp/cvs-serv28473/modules Added Files: index.html Log Message: Fresh start... |
From: Adam A. <ra...@us...> - 2003-10-15 03:29:38
|
Update of /cvsroot/phpmp/phpMP/templates_cache In directory sc8-pr-cvs1:/tmp/cvs-serv28473/templates_cache Added Files: index.html Log Message: Fresh start... |
From: Adam A. <ra...@us...> - 2003-10-15 03:25:23
|
Update of /cvsroot/phpmp/phpMP/admin/db In directory sc8-pr-cvs1:/tmp/cvs-serv28043/db Log Message: Directory /cvsroot/phpmp/phpMP/admin/db added to the repository |
From: Adam A. <ra...@us...> - 2003-10-15 03:21:13
|
Update of /cvsroot/phpmp/phpMP/install/schemas In directory sc8-pr-cvs1:/tmp/cvs-serv27590/schemas Log Message: Directory /cvsroot/phpmp/phpMP/install/schemas added to the repository |
From: Adam A. <ra...@us...> - 2003-10-15 03:07:34
|
Update of /cvsroot/phpmp/phpMP/templates/BlueMP/css In directory sc8-pr-cvs1:/tmp/cvs-serv25621/templates/BlueMP/css Removed Files: base.css Log Message: Fresh start... --- base.css DELETED --- |
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/templates In directory sc8-pr-cvs1:/tmp/cvs-serv25621/templates Removed Files: index.html Log Message: Fresh start... --- index.html DELETED --- |
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/language In directory sc8-pr-cvs1:/tmp/cvs-serv25621/language Removed Files: index.html Log Message: Fresh start... --- index.html DELETED --- |
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/templates/BlueMP In directory sc8-pr-cvs1:/tmp/cvs-serv25621/templates/BlueMP Removed Files: footer.html header.html index.html left_column.html right_column.html Log Message: Fresh start... --- footer.html DELETED --- --- header.html DELETED --- --- index.html DELETED --- --- left_column.html DELETED --- --- right_column.html DELETED --- |