Example #1
0
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > FORUM_DATABASE_QUERY_MAXIMUM_LENGTH) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     $this->query_result = $this->link_id->query($sql);
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = $this->link_id->lastErrorCode();
         $this->error_msg = $this->link_id->lastErrorMsg();
         if ($this->in_transaction) {
             $this->link_id->exec('ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         if ($this->in_transaction) {
             mysql_query('ROLLBACK', $this->link_id);
         }
         --$this->in_transaction;
         return false;
     }
 }
Example #3
0
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > FORUM_DATABASE_QUERY_MAXIMUM_LENGTH) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         return false;
     }
 }
Example #4
0
?>
	<p id="copyright">Ishare+, Forum Board &copy; December 2012. Integrated by <a href="http://hik3.net">hik3studio</a>. Powered by <a href="http://mpp.eng.usm.my/sharers/team.php">Ishare Technology Team</a>. All rights reserved.</p>
<?php 
($hook = get_hook('ft_about_end')) ? eval($hook) : null;
$tpl_temp = forum_trim(ob_get_contents());
$tpl_main = str_replace('<!-- forum_about -->', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <!-- forum_about -->
// START SUBST - <!-- forum_debug -->
if (defined('FORUM_DEBUG') || defined('FORUM_SHOW_QUERIES')) {
    ob_start();
    ($hook = get_hook('ft_debug_output_start')) ? eval($hook) : null;
    // Display debug info (if enabled/defined)
    if (defined('FORUM_DEBUG')) {
        // Calculate script generation time
        $time_diff = forum_microtime() - $forum_start;
        $query_time_total = $time_percent_db = 0.0;
        $saved_queries = $forum_db->get_saved_queries();
        if (count($saved_queries) > 0) {
            foreach ($saved_queries as $cur_query) {
                $query_time_total += $cur_query[1];
            }
            if ($query_time_total > 0 && $time_diff > 0) {
                $time_percent_db = $query_time_total / $time_diff * 100;
            }
        }
        echo '<p id="querytime" class="quiet">' . sprintf($lang_common['Querytime'], forum_number_format($time_diff, 3), forum_number_format(100 - $time_percent_db, 0), forum_number_format($time_percent_db, 0), forum_number_format($forum_db->get_num_queries())) . '</p>' . "\n";
    }
    if (defined('FORUM_SHOW_QUERIES')) {
        echo get_saved_queries();
    }
Example #5
0
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > FORUM_DATABASE_QUERY_MAXIMUM_LENGTH) {
         exit('Insane query. Aborting.');
     }
     if (strrpos($sql, 'LIMIT') !== false) {
         $sql = preg_replace('#LIMIT ([0-9]+),([ 0-9]+)#', 'LIMIT \\2 OFFSET \\1', $sql);
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     @pg_send_query($this->link_id, $sql);
     $this->query_result = @pg_get_result($this->link_id);
     if (pg_result_status($this->query_result) != PGSQL_FATAL_ERROR) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         $this->last_query_text[$this->query_result] = $sql;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_msg = @pg_result_error($this->query_result);
         if ($this->in_transaction) {
             @pg_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }