$hesklang[mysql_said]:
(".mysqli_connect_errno().") ".mysqli_connect_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 @mysqli_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 = @mysqli_query($hesk_db_link, $query)) { return $res; } else { hesk_dbHandleFailure($query); } } // END hesk_dbQuery() function hesk_dbHandleFailure($query) { global $hesk_settings, $hesklang, $hesk_db_link; $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]:
".mysqli_error($hesk_db_link)."

"); } 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' => mysqli_error($hesk_db_link) )); } 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'] ? mysqli_error($hesk_db_link) : $hesklang['cant_sql']; throw new Exception($message); } } function hesk_dbFetchAssoc($res) { return @mysqli_fetch_assoc($res); } // END hesk_FetchAssoc() function hesk_dbFetchRow($res) { return @mysqli_fetch_row($res); } // END hesk_FetchRow() function hesk_dbResult($res, $row = 0, $column = 0) { $i=0; $res->data_seek(0); while ($tmp = @mysqli_fetch_array($res, MYSQLI_NUM)) { if ($i==$row) { return $tmp[$column]; } $i++; } return ''; } // END hesk_dbResult() function hesk_dbInsertID() { global $hesk_db_link; if ($lastid = @mysqli_insert_id($hesk_db_link)) { return $lastid; } } // END hesk_dbInsertID() function hesk_dbFreeResult($res) { return @mysqli_free_result($res); } // END hesk_dbFreeResult() function hesk_dbNumRows($res) { return @mysqli_num_rows($res); } // END hesk_dbNumRows() function hesk_dbAffectedRows() { global $hesk_db_link; return @mysqli_affected_rows($hesk_db_link); } // END hesk_dbAffectedRows()