2009-11-05 Esteban Sanchez <estebans@artica.es>

* include/functions_db.php: Added sql_error_handler() to show SQL
	errors. Improved SQL error messages in process_sql() so it shows now
	the failing sentence, the file and the line of the call.

	* index.php: Moved load_extensions() call after enterprise
	instalation so enterprise extensions are installed properly.

	* godmode/profiles/profile_list.php: HTML tags nesting fixed.

	* ChangeLog: Fixed previous commit message style.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1219 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2008-11-05 13:12:45 +00:00
parent 73dcde4b71
commit 1ae91e7281
4 changed files with 52 additions and 23 deletions

View File

@ -1,3 +1,16 @@
2009-11-05 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added sql_error_handler() to show SQL
errors. Improved SQL error messages in process_sql() so it shows now
the failing sentence, the file and the line of the call.
* index.php: Moved load_extensions() call after enterprise
instalation so enterprise extensions are installed properly.
* godmode/profiles/profile_list.php: HTML tags nesting fixed.
* ChangeLog: Fixed previous commit message style.
2008-11-05 Ramon Novoa <rnovoa@artica.es>
* pandoradb.sql: Deleted 'id_inventory_server' column from 'tagente'

View File

@ -281,7 +281,7 @@ if ($id_profile || $new_profile) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
print_input_hidden ('new_profile', 1);
print_submit_button (__('Create profile'), "crt", false, 'class="sub next"');
echo '</form>';
echo "</div>";
echo '</form>';
}
?>

View File

@ -1424,6 +1424,17 @@ function get_db_all_rows_sql ($sql) {
return false;
}
/**
* Error handler function when an SQL error is triggered.
*
* @param $errno Level of the error raised (not used, but required by set_error_handler()).
* @param $errstr Contains the error message.
*/
function sql_error_handler ($errno, $errstr) {
echo "<strong>SQL error</strong>: ".$errstr."<br />\n";
return true;
}
/**
* This function comes back with an array in case of SELECT
* in case of UPDATE, DELETE etc. with affected rows
@ -1450,7 +1461,12 @@ function process_sql ($sql, $rettype = "affected_rows") {
} else {
$result = mysql_query ($sql);
if ($result === false) {
trigger_error (mysql_error ());
$backtrace = debug_backtrace ();
$error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d',
mysql_error (), $sql, $backtrace[0]['file'], $backtrace[0]['line']);
set_error_handler ('sql_error_handler');
trigger_error ($error);
restore_error_handler ();
return false;
} elseif ($result === true) {
if ($rettype == "insert_id") {

View File

@ -63,14 +63,14 @@ session_start();
require_once ("include/config.php");
require_once ("include/functions.php");
require_once ("include/functions_db.php");
//We should require this or you might end up with some empty strings
load_extensions ($config['extensions']);
/* Enterprise support */
if (file_exists ("enterprise/load_enterprise.php")) {
include ("enterprise/load_enterprise.php");
if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) {
include (ENTERPRISE_DIR."/load_enterprise.php");
}
load_extensions ($config['extensions']);
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>';
// Pure mode (without menu, header and footer).