@@ -188,8 +188,6 @@ private function _setCharset() {
188188 }
189189
190190 private function _query ($ sQuery = '' ) {
191- global $ app ;
192-
193191 $ this ->do_connect ();
194192
195193 if ($ sQuery == '' ) {
@@ -206,10 +204,8 @@ private function _query($sQuery = '') {
206204 if ($ this ->errorNumber == '111 ' ) {
207205 // server is not available
208206 if ($ try > 9 ) {
209- if (isset ($ app ) && isset ($ app ->forceErrorExit )) {
210- $ app ->forceErrorExit ('Database connection failure! ' );
211- }
212- // if we reach this, the app object is missing or has no exit method, so we continue as normal
207+ $ this ->_sqlerror ('DB::query -> error connecting ' );
208+ exit ;
213209 }
214210 sleep (30 ); // additional seconds, please!
215211 }
@@ -441,18 +437,13 @@ private function check_utf8($str) {
441437 * @return string escaped string
442438 */
443439 public function escape ($ sString ) {
444- global $ app ;
445440 if (!is_string ($ sString ) && !is_numeric ($ sString )) {
446- $ app ->log ('NON-String given in escape function! ( ' . gettype ($ sString ) . ') ' , LOGLEVEL_INFO );
447- //$sAddMsg = getDebugBacktrace();
448- $ app ->log ($ sAddMsg , LOGLEVEL_DEBUG );
449441 $ sString = '' ;
450442 }
451443
452444 $ cur_encoding = mb_detect_encoding ($ sString );
453445 if ($ cur_encoding != "UTF-8 " ) {
454446 if ($ cur_encoding != 'ASCII ' ) {
455- $ app ->log ('String ' . substr ($ sString , 0 , 25 ) . '... is ' . $ cur_encoding . '. ' , LOGLEVEL_INFO );
456447 if ($ cur_encoding ) $ sString = mb_convert_encoding ($ sString , 'UTF-8 ' , $ cur_encoding );
457448 else $ sString = mb_convert_encoding ($ sString , 'UTF-8 ' );
458449 }
@@ -470,7 +461,7 @@ public function escape($sString) {
470461 * @access private
471462 */
472463 private function _sqlerror ($ sErrormsg = 'Unbekannter Fehler ' , $ sAddMsg = '' ) {
473- global $ app , $ conf ;
464+ global $ conf ;
474465
475466 $ mysql_error = (is_object ($ this ->_iConnId ) ? mysqli_error ($ this ->_iConnId ) : mysqli_connect_error ());
476467 $ mysql_errno = (is_object ($ this ->_iConnId ) ? mysqli_errno ($ this ->_iConnId ) : mysqli_connect_errno ());
@@ -479,9 +470,7 @@ private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '') {
479470
480471 if ($ this ->show_error_messages && $ conf ['demo_mode ' ] === false ) {
481472 echo $ sErrormsg . $ sAddMsg ;
482- } else if (is_object ($ app ) && method_exists ($ app , 'log ' )) {
483- $ app ->log ($ sErrormsg . $ sAddMsg . ' -> ' . $ mysql_errno . ' ( ' . $ mysql_error . ') ' , LOGLEVEL_WARN );
484- }
473+ }
485474 }
486475
487476 public function affectedRows () {
0 commit comments