$hesklang[mysql_said]:
".mysql_error()."

"); } else { hesk_error("$hesklang[cant_connect_db]

$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]

"); } } if ( ! @mysql_select_db($hesk_settings['db_name'], $hesk_db_link)) { if ($hesk_settings['debug_mode']) { hesk_error("$hesklang[cant_connect_db]

$hesklang[mysql_said]:
".mysql_error()."

"); } else { hesk_error("$hesklang[cant_connect_db]

$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]

"); } } // Check MySQL/PHP version and set encoding to utf8 hesk_dbSetNames(); // Set the correct timezone hesk_dbSetTimezone(); return $hesk_db_link; } // END hesk_dbConnect() function hesk_dbClose() { global $hesk_db_link; return @mysql_close($hesk_db_link); } // END hesk_dbClose() function hesk_dbQuery($query) { global $hesk_last_query; global $hesk_db_link; global $hesklang, $hesk_settings; if ( ! $hesk_db_link && ! hesk_dbConnect()) { return false; } $hesk_last_query = $query; #echo "

EXPLAIN $query

\n"; if ($res = @mysql_query($query, $hesk_db_link)) { return $res; } else { hesk_dbHandleFailure($query); } } // END hesk_dbQuery() function hesk_dbHandleFailure($query) { global $hesk_settings, $hesklang; $valid_response_types = array('json', 'throw'); if (!isset($hesk_settings['db_failure_response']) || !in_array($hesk_settings['db_failure_response'], $valid_response_types)) { if ($hesk_settings['debug_mode']) { hesk_error("$hesklang[cant_sql]: $query

$hesklang[mysql_said]:
".mysql_error()."

"); } else { hesk_error("$hesklang[cant_sql]

$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]

"); } } elseif ($hesk_settings['db_failure_response'] === 'json') { header('Content-Type: application/json'); http_response_code(500); if ($hesk_settings['debug_mode']) { print json_encode(array( 'status' => 'failure', 'title' => $hesklang['cant_sql'], 'message' => mysql_error() )); } else { print json_encode(array( 'status' => 'failure', 'title' => $hesklang['cant_sql'], 'message' => sprintf('%s: %s', $hesklang['contact_webmsater'], $hesk_settings['webmaster_mail']) )); } exit(); } elseif ($hesk_settings['db_failure_response'] === 'throw') { $message = $hesk_settings['debug_mode'] ? mysql_error() : $hesklang['cant_sql']; throw new Exception($message); } } function hesk_dbFetchAssoc($res) { return @mysql_fetch_assoc($res); } // END hesk_FetchAssoc() function hesk_dbFetchRow($res) { return @mysql_fetch_row($res); } // END hesk_FetchRow() function hesk_dbResult($res, $row = 0, $column = 0) { return @mysql_result($res, $row, $column); } // END hesk_dbResult() function hesk_dbInsertID() { global $hesk_db_link; if ($lastid = @mysql_insert_id($hesk_db_link)) { return $lastid; } } // END hesk_dbInsertID() function hesk_dbFreeResult($res) { return mysql_free_result($res); } // END hesk_dbFreeResult() function hesk_dbNumRows($res) { return @mysql_num_rows($res); } // END hesk_dbNumRows() function hesk_dbAffectedRows() { global $hesk_db_link; return @mysql_affected_rows($hesk_db_link); } // END hesk_dbAffectedRows()