[u][b]Voici le contenu du fichiers incriminé en question :[/b][/u]
Je vois bien la balise de début du language php ([color=#FF0000]<?php[/color]) mais je ne trouve pas la balise de cloture dans le fichier ([color=#FF0000]<?[/color])!?
J'ai aussi mis les caractères en rouges de la ligne de code 385 qui est incriminée dans le message d'erreur en espérant que cela pourrai vous aidez!?
[php]<?php
/**
* $Source: /home/cvs/nukescripts/kernel/db/mysql.php,v $
* $Revision: 1.1.2-1 $
* $Author: cyril $
* $Date: 2009/10/30 23:09:51 $
*
*/
/************************************************************************/
/* Maximus CMS: Web Portal System */
/* ============================== */
/* */
/* Copyright (c) 2002 - 2008 */
/* http://www.php-maximus.org */
/*
[email protected] */
/* */
/* 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. */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System */
/************************************************************************/
defined('MAXIMUS') or die ('Access denied mysql MAXIMUS directly...');
if(!defined('SQL_LAYER')){
define('SQL_LAYER','mysql');
define('XMFbin_ERROR', 'Binaire error');
define('XMFnum_ERROR', 'Numeraire error');
define('XMFlang_ERROR', 'Language error');
class sql_db{
var $db_connect_id;
var $query_result;
var $row = array();
var $rowset = array();
var $num_queries = 0;
var $caching = false;
var $cached = false;
var $cache = array();
var $sql_time = 0; // SQL excution time - added by Smartor
function timing(){
list($usec, $sec) = explode(' ',microtime());
return ((float)$usec + (float)$sec);
}
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true) {
$start_time = $this->timing();
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
if( !empty( $this->persistency ) ) {
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
} else {
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
}
if($this->db_connect_id) {
if( ! empty( $database ) ) {
$this->dbname = $database;
$dbselect = @mysql_select_db($this->dbname);
if(!$dbselect) {
@mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect;
}
}
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $this->db_connect_id;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
//
// Other base methods
//
function sql_close() {
@mysql_close( $this->db_connect_id );
}
//
// Base query method
//
function sql_query($query = '', $transaction = FALSE, $cache = false) {
// Remove any pre-existing queries
if ( !empty($query) ) {
unset($this->query_result);
}
// Check cache
$this->caching = false;
$this->cache = array();
$this->cached = false;
if( ! empty( $query ) && $cache){
global $phpbb_root_path;
$hash = md5($query);
if(strlen($cache)){
$hash = $cache . $hash;
}
$filename = CACHE.'/Modules/sql_' . $hash . '.php';
if(@is_file($filename)) {
$set = array();
include($filename);
$this->cache = $set;
$this->cached = true;
$this->caching = false;
return 'cache';
}
$this->caching = $hash;
}
// not cached
$this->num_queries++;
$start_time = $this->timing();
if( !empty( $query ) ) { // fix frenatus 18/06/2006 pour php4
( PHP_VERSION > '5.0.0' ) ? $query = str_ireplace('union', 'uni­on', $query) : $query = eregi_replace('union', 'uni­on', $query);
$this->query_result = @mysql_query($query, $this->db_connect_id);
}
if( ! empty( $this->query_result ) ) {
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $this->query_result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return ( $transaction == 'END_TRANSACTION' ) ? true : false;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0) {
if($query_id === 'cache' && $this->cached) {
return count($this->cache);
}
$start_time = $this->timing();
if( empty( $query_id ) ) {
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ) {
$result = @mysql_num_rows($query_id);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_affectedrows() {
$start_time = $this->timing();
if($this->db_connect_id) {
$result = @mysql_affected_rows($this->db_connect_id);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_numfields($query_id = 0) {
$start_time = $this->timing();
if( empty( $query_id ) ) {
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ) {
$result = @mysql_num_fields($query_id);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_fieldname($offset, $query_id = 0) {
$start_time = $this->timing();
if( empty( $query_id ) ){
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ){
$result = @mysql_field_name($query_id, $offset);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_fieldtype($offset, $query_id = 0) {
$start_time = $this->timing();
if( empty( $query_id ) ){
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ){
$result = @mysql_field_type($query_id, $offset);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_fetchrow($query_id = 0){
if($query_id === 'cache' && $this->cached){
return count($this->cache) ? array_shift($this->cache) : false;
}
$start_time = $this->timing();
if( empty( $query_id ) ) {
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ) {
$this->row[$query_id] = @mysql_fetch_array($query_id);
if($this->caching) {
if($this->row[$query_id] === false) {
$this->write_cache();
}
$this->cache[] = $this->row[$query_id];
}
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $this->row[$query_id];
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_fetchrowset($query_id = 0) {
if($query_id === 'cache' && $this->cached) {
return $this->cache;
}
$start_time = $this->timing();
if( empty( $query_id ) ) {
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ) {
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
while($this->rowset[$query_id] = @mysql_fetch_array($query_id)) {
if( ! empty( $this->caching ) ) {
if($this->row[$query_id] === false) {
$this->write_cache();
}
$this->cache[] = $this->row[$query_id];
}
$result[] = $this->rowset[$query_id];
}
if( ! empty( $this->caching ) ) {
$this->write_cache();
}
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return @$result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_fetchfield($field, $rownum = -1, $query_id = 0){
$start_time = $this->timing();
if( empty( $query_id ) ){
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ){
if($rownum > -1){
$result = @mysql_result($query_id, $rownum, $field);
} else {
if(empty($this->row[$query_id]) && empty($this->rowset[$query_id])) {
if($this->sql_fetchrow()) {
$result = $this->row[$query_id][$field];
}
} else {
if($this->rowset[$query_id]) {
$result = $this->rowset[$query_id][$field];
} elseif($this->row[$query_id]) {
$result = $this->row[$query_id][$field];
}
}
}
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_rowseek($rownum, $query_id = 0) {
$start_time = $this->timing();
if( empty( $query_id ) ) {
$query_id = $this->query_result;
}
if( ! empty( $query_id ) ) {
$result = @mysql_data_seek($query_id, $rownum);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_nextid() {
$start_time = $this->timing();
if( ! empty( $this->db_connect_id ) ) {
$result = @mysql_insert_id($this->db_connect_id);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_freeresult($query_id = 0){
if($query_id === 'cache'){
$this->caching = false;
$this->cached = false;
$this->cache = array();
}
if( ! empty( $this->caching ) ){
$this->write_cache();
}
$start_time = $this->timing();
if( empty( $query_id ) ) {
$query_id = $this->query_result;
}
if ( ! empty( $query_id ) ){
unset($this->row[$query_id]);
unset($this->rowset[$query_id]);
@mysql_free_result($query_id);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return true;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return false;
}
}
function sql_fetch_rowset($result){
$rowset = array();
while ($row = @mysql_fetch_array($result)) $rowset[] = $row;
return $rowset;
}
function sql_object( $query_id = '' ) {
if ( !empty( $query_id ) ) {
$query_id = @mysql_fetch_object( $query_id );
return $query_id;
} else {
return false;
}
}
function query( $query = '', $type= false, $transaction = false ) {
$start_time = $this->timing();
!empty( $type ) ? $type : $type = 'Query';
$query_error = false;
$sql = @mysql_query($query, $this->db_connect_id);
if( ! empty( $sql ) ){
$this->num_queries++;
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
maxdebug($query, '', $endtime, $type); // Ligne 385
return $sql;
} else {
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
maxdebug( '' , $query, $endtime, $type);
query_die(CORE_ERROR, 'Could not Query', '', '', '', $query);
return ( $transaction == 'END_TRANSACTION' ) ? true : false;
}
}
function get_object( $query = '', $transaction = false ) {
$start_time = $this->timing();
$result = $this->query( $query, 'Get Object' );
$returned = @mysql_fetch_object( $result );
if( empty( $returned ) ){
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return ( $transaction == 'END_TRANSACTION' ) ? true : false;
} else {
@mysql_free_result($result);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $returned;
}
}
function get_list_object($query) {
$start_time = $this->timing();
$returned = array();
$result = $this->query($query, 'Get List Object');
while ($row = @mysql_fetch_object( $result ) ) {
$returned[] = $row;
}
@mysql_free_result($result);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $returned;
}
function get_list_row($query) {
$start_time = $this->timing();
$returned = array();
$result = $this->query($query, 'Get List Row');
while ($row = @mysql_fetch_array( $result ) ) {
$returned[] = $row;
}
@mysql_free_result($result);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $returned;
}
function get_list($query) {
$returned = array();
$result = $this->query($query, 'Get List Array');
while ($row = @mysql_fetch_assoc($result)) {
$returned[] = $row;
}
@mysql_free_result($result);
return $returned;
}
function get_row($query) {
$start_time = $this->timing();
$result = $this->query($query, 'Get Row');
$returned = @mysql_fetch_array($result);
@mysql_free_result($result);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $returned;
}
function get_num($query) {
$start_time = $this->timing();
$result = $this->query($query, 'Get Num');
$num = @mysql_num_rows($result);
@mysql_free_result($result);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $num;
}
function sql_free( $query_id = 0 ) {
if (!empty($query_id) ) {
@mysql_free_result($query_id);
} else {
return false;
}
}
function sql_error($query_id = 0) {
$start_time = $this->timing();
$result['message'] = @mysql_error($this->db_connect_id);
$result['code'] = @mysql_errno($this->db_connect_id);
$endtime = $this->timing();
$this->sql_time += $endtime - $start_time;
return $result;
}
function XMFbin($var) {
$var = intval( $var );
if ( preg_match( '`[0-1]`', $var ) ) {
return (bool)$var;
} else {
query_die(XMFbin_ERROR, 'XMFbin not allow '.$var.'', '', '', '', $var);
}
}
function XMFnum($var) {
$var = intval( $var );
if ( preg_match( '`[0-9]`', $var ) ) {
return (int)$var;
} else {
query_die(XMFnum_ERROR, 'XMFnum not allow '.$var.'', '', '', '', $var);
}
}
function XMFlang($var) {
if ( empty( $var ) ) { return ; }
if ( preg_match( '`(english|french|italian|spanish|japanese|all)`', $var ) or empty( $var ) ) {
return $var;
} else {
query_die(XMFlang_ERROR, 'XMFlang not allow '.$var.'', '', '', '', $var);
}
}
function write_cache() {
if( empty( $this->caching ) ) {
return;
}
global $phpbb_root_path;
$f = @fopen($phpbb_root_path . '../../'.CACHE.'/Modules/sql_' . $this->caching . '.php', 'w');
$data = @var_export($this->cache, true);
@fputs($f, '<?php $set = ' . $data . ';');
@fclose($f);
@chmod($phpbb_root_path . '../../'.CACHE.'/Modules/sql_' . $this->caching . '.php', 0777);
$this->caching = false;
$this->cached = false;
$this->cache = array();
}
function clear_cache($prefix = ''){
global $phpbb_root_path;
$this->caching = false;
$this->cached = false;
$this->cache = array();
$prefix = 'sql_' . $prefix;
$prefix_len = strlen($prefix);
$res = @opendir($phpbb_root_path . '../../'.CACHE.'/Modules');
if( !empty( $res ) ){
while(($file = @readdir($res)) !== false){
if(substr($file, 0, $prefix_len) === $prefix){
@unlink($phpbb_root_path . '../../'.CACHE.'/Modules/' . $file);
}
}
}
@closedir($res);
}
} // class sql_db
} // if ... define[/php]