Exemplo n.º 1
0
 /**
  * log or display DB errors in the browser
  */
 public function reportError($qry = '')
 {
     if (empty($this->debug)) {
         return false;
     }
     // if critical, should at least show an error code in browser
     $debug = $this->critical && $this->debug < 2 ? 2 : $this->debug;
     $html = '';
     $str = 'DB Error #' . $this->connector->getErrorNo() . ' : ' . $this->connector->getErrorMsg();
     switch ($debug) {
         case 2:
             echo '<p>DB Error #' . $this->connector->getErrorNo() . '</p>';
         case 1:
             if ($qry) {
                 FC::log_error($qry);
             }
         case 4:
             FC::log_error($str);
             break;
         case 3:
             if ($qry) {
                 $htm = '<br /><code>' . htmlentities($qry) . '</code>';
             }
         case 5:
             $htm = nl2br(htmlentities($str)) . $htm;
             break;
         default:
             echo '<p>DB DEBUG level undefined</p>';
             break;
     }
     echo '<p>' . $htm . '</p>';
     if ($this->critical) {
         exit;
     }
 }
 /**
  * log or display DB errors in the browser
  */
 public function reportError($qry = '')
 {
     if (!$this->debug) {
         return false;
     }
     $str = 'DB Error #' . $this->connector->getErrorNo() . ' : ' . $this->connector->getErrorMsg();
     switch ($this->debug) {
         case 1:
         case 3:
             FC::log_error($str);
             if ($qry) {
                 FC::log_error($str);
             }
             break;
         case 2:
         case 4:
             echo '<p>' . nl2br(htmlentities($str));
             echo '<br /><code>' . htmlentities($qry) . '</code></p>';
             break;
         default:
             echo '<p>DB DEBUG level undefined</p>';
             break;
     }
     if ($this->critical) {
         exit;
     }
 }
Exemplo n.º 3
0
 public function setupTimeZone()
 {
     if (!$this->isEmpty('time_zone')) {
         try {
             $GLOBALS['config']['datetime']['timezone_user'] = new DateTimeZone($this->get('time_zone'));
             // FC::log_debug('User::setupTimeZone : new time zone '.$this->get('time_zone'));
         } catch (Exception $e) {
             FC::log_error('User::setupTimeZone : unknown time zone (' . $this->get('time_zone') . ')');
         }
     }
 }