Example #1
0
 public static function get($new_connection = false)
 {
     if (!isset(self::$config)) {
         self::$config = server_get_config();
     }
     if (!db::$connection || $new_connection) {
         $db = new self(self::$config['db_server'], self::$config['db_username'], self::$config['db_password'], self::$config['db_database'], self::$config['db_port']);
         if (mysqli_connect_error()) {
             throw new Exception(sprintf('Could not connect to database server. Error received: %s', mysqli_connect_error()), MYSQL_CONNECT_ERROR);
         }
         if (!$db->set_charset('utf8')) {
             throw new Exception('Could not change MySQL character-set. Check your MySQL user credentials');
         }
         if (!$db->set_time_zone()) {
             throw new Exception('Could not change MySQL time-zone. Check your MySQL user credentials');
         }
         if (isset($config['mysql_big_selects']) && $config['mysql_big_selects'] === true) {
             if (!$db->enable_compat_mode()) {
                 throw new Exception('Could not change MYSQL compatbility options. Check your MySQL user permissions.');
             }
         }
         if ($new_connection) {
             return $db;
         }
         db::$connection = $db;
     }
     return db::$connection;
 }
Example #2
0
function cache_check_enabled()
{
    $config = server_get_config();
    if (isset($config['http_cache_enabled']) && $config['http_cache_enabled'] === false) {
        return false;
    }
    return true;
}
Example #3
0
function html_get_top_frame_name()
{
    $config = server_get_config();
    if (!isset($config['frame_top_target']) || strlen(trim($config['frame_top_target'])) == 0) {
        return '_top';
    }
    return $config['frame_top_target'];
}
function bh_error_send_email(Exception $exception)
{
    $config = server_get_config();
    if (isset($config['error_report_email_addr_to']) && strlen(trim($config['error_report_email_addr_to'])) > 0) {
        $error_report_email_addr_to = trim($config['error_report_email_addr_to']);
    } else {
        $error_report_email_addr_to = '';
    }
    if (isset($config['error_report_email_addr_from']) && strlen(trim($config['error_report_email_addr_from'])) > 0) {
        $error_report_email_addr_from = trim($config['error_report_email_addr_from']);
    } else {
        $error_report_email_addr_from = '*****@*****.**';
    }
    if (strlen($error_report_email_addr_to) > 0 && !defined('BEEHIVE_DEVELOPER_MODE')) {
        $error_msg_array = bh_error_process($exception);
        $error_log_email_message = implode("\n\n", array_filter(array_map('strip_tags', $error_msg_array), 'strlen'));
        $headers = "Return-path: {$error_report_email_addr_from}\n";
        $headers .= "From: \"Beehive Forum Error Report\" <{$error_report_email_addr_from}>\n";
        $headers .= "Reply-To: \"Beehive Forum Error Report\" <{$error_report_email_addr_from}>\n";
        $headers .= "Content-type: text/plain; charset=UTF-8\n";
        $headers .= "X-Mailer: PHP/" . phpversion() . "\n";
        $headers .= "X-Beehive-Forum: Beehive Forum " . BEEHIVE_VERSION;
        @mail($error_report_email_addr_to, "Beehive Forum Error Report", $error_log_email_message, $headers);
    }
}
Example #5
0
function cache_check_enabled()
{
    if (defined('BEEHIVE_DEVELOPER_MODE')) {
        return false;
    }
    $config = server_get_config();
    if (isset($config['http_cache_enabled']) && $config['http_cache_enabled'] === false) {
        return false;
    }
    return true;
}