mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- show complete sql error message + path to administrators only (idea from post to bugtraq about SMF)
git-svn-id: file:///svn/phpbb/trunk@5338 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7657767590
commit
d160126086
2 changed files with 16 additions and 3 deletions
|
@ -192,14 +192,26 @@ class dbal
|
||||||
*/
|
*/
|
||||||
function sql_error($sql = '')
|
function sql_error($sql = '')
|
||||||
{
|
{
|
||||||
|
global $auth, $user;
|
||||||
|
|
||||||
$error = $this->_sql_error();
|
$error = $this->_sql_error();
|
||||||
|
|
||||||
if (!$this->return_on_error)
|
if (!$this->return_on_error)
|
||||||
|
{
|
||||||
|
$message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . '];
|
||||||
|
|
||||||
|
// Show complete SQL error and path to administrators only
|
||||||
|
if ($auth->acl_get('a_'))
|
||||||
{
|
{
|
||||||
$this_page = (isset($_SERVER['PHP_SELF']) && !empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF'];
|
$this_page = (isset($_SERVER['PHP_SELF']) && !empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF'];
|
||||||
$this_page .= '&' . ((isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : (isset($_ENV['QUERY_STRING']) ? $_ENV['QUERY_STRING'] : ''));
|
$this_page .= '&' . ((isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : (isset($_ENV['QUERY_STRING']) ? $_ENV['QUERY_STRING'] : ''));
|
||||||
|
|
||||||
$message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']<br /><br /><u>CALLING PAGE</u><br /><br />' . htmlspecialchars($this_page) . (($sql != '') ? '<br /><br /><u>SQL</u><br /><br />' . $sql : '') . '<br />';
|
$message .= '<br /><br /><u>CALLING PAGE</u><br /><br />' . htmlspecialchars($this_page) . (($sql != '') ? '<br /><br /><u>SQL</u><br /><br />' . $sql : '') . '<br />';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message .= '<br /><br />' . $user->lang['SQL_ERROR_OCCURRED'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->transaction)
|
if ($this->transaction)
|
||||||
{
|
{
|
||||||
|
|
|
@ -362,6 +362,7 @@ $lang = array_merge($lang, array(
|
||||||
'SORT_TOPIC_TITLE' => 'Topic Title',
|
'SORT_TOPIC_TITLE' => 'Topic Title',
|
||||||
'SORT_USERNAME' => 'Username',
|
'SORT_USERNAME' => 'Username',
|
||||||
'SPLIT_TOPIC' => 'Split Topic',
|
'SPLIT_TOPIC' => 'Split Topic',
|
||||||
|
'SQL_ERROR_OCCURRED' => 'An sql error occurred while fetching this page. Please contact an administrator if this problem persist.',
|
||||||
'STATISTICS' => 'Statistics',
|
'STATISTICS' => 'Statistics',
|
||||||
'START_WATCHING_FORUM' => 'Subscribe Forum',
|
'START_WATCHING_FORUM' => 'Subscribe Forum',
|
||||||
'START_WATCHING_TOPIC' => 'Subscribe Topic',
|
'START_WATCHING_TOPIC' => 'Subscribe Topic',
|
||||||
|
|
Loading…
Add table
Reference in a new issue