Example #1
0
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES')) {
         $q_start = get_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')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         return false;
     }
 }
Example #2
0
function ptime()
{
    global $time_start;
    $time_end = get_microtime();
    $ptime = $time_end - $time_start;
    return substr($ptime, 0, 8);
}
Example #3
0
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     $this->last_query = $sql;
     if (defined('LUNA_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     $this->query_result = $this->link_id->query($sql);
     if ($this->query_result) {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('LUNA_SHOW_QUERIES')) {
             $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;
     }
 }
Example #4
0
 function query($query, $bypass_error = FALSE, $unbufferd = false)
 {
     $this->querytime = get_microtime();
     $this->query_result = $this->connect_id->query($query, $unbufferd ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);
     if ($this->query_result) {
         return $this->query_result;
     } else {
         if (($this->connect_id->errno == 1030 && strpos($this->connect_id->error, '127') || $this->connect_id->errno == 1034 || $this->connect_id->errno == 1035) && preg_match('#(INTO|FROM)\\s+([a-z_]+)#i', $query, $match) && $this->connect_id->query('REPAIR TABLE ' . $match[2])) {
             $this->query_result = $this->connect_id->query($query, $unbufferd ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);
             if ($this->query_result) {
                 return $this->query_result;
             }
         } else {
             if ($this->connect_id->errno == 1062 && preg_match('#ALTER\\s+TABLE\\s+([a-z_]+)\\s+ADD\\s+PRIMARY\\s+KEY\\s+\\(([a-z_]+)\\)#i', $query, $table) && preg_match("#Duplicate\\s+entry\\s+'(.*)'\\s+for\\s+key#i", $this->connect_id->error, $entry) && $this->connect_id->query("DELETE FROM {$table['1']} WHERE {$table['2']} LIKE '{$entry['1']}%' LIMIT " . ($this->connect_id->query("SELECT {$table['2']} FROM {$table['1']} WHERE {$table['2']} LIKE '{$entry['1']}%'")->num_rows - 1)) || $this->connect_id->errno == 1062 && preg_match('#CREATE\\s+UNIQUE\\s+INDEX\\s+([a-z_]+)\\s+ON\\s+([a-z_]+)\\s+\\(([a-z_]+)\\)#i', $query, $table) && preg_match("#Duplicate\\s+entry\\s+'(.*)'\\s+for\\s+key#i", $this->connect_id->error, $entry) && $this->connect_id->query("DELETE FROM {$table['2']} WHERE {$table['3']} LIKE '{$entry['1']}%' LIMIT " . ($this->connect_id->query("SELECT {$table['3']} FROM {$table['2']} WHERE {$table['3']} LIKE '{$entry['1']}%'")->num_rows - 1))) {
                 return $this->query($query, $bypass_error, $unbufferd);
             } else {
                 if ($this->connect_id->errno == 1007 && preg_match('#CREATE\\s+DATABASE\\s+#i', $query)) {
                     return true;
                 }
             }
         }
     }
     if ($bypass_error) {
         return NULL;
     } else {
         $this->show_error("While executing query \"{$query}\"\n\nthe following error occured: " . $this->connect_id->error);
     }
 }
Example #5
0
 function query($sql, $unbuffered = false)
 {
     if (defined('PUN_SHOW_QUERIES')) {
         $q_start = get_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('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysql_errno($this->link_id);
         $this->error_msg = @mysql_error($this->link_id);
         return false;
     }
 }
 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('OPENLD_SHOW_QUERIES')) {
         $q_start = microtime_float();
     }
     $this->query_result = @mysqli_query($this->link_id, $sql);
     if ($this->query_result) {
         if (defined('OPENLD_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('OPENLD_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         // Rollback transaction
         if ($this->in_transaction) {
             mysqli_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
 /**
  * Make sure that the model is configured with a valid URL.
  *
  * @return string json
  */
 function build()
 {
     if ($site_id = $this->config('site_id')) {
         $s = get_microtime();
         $es = new entity_selector();
         $es->add_type(id_of('social_account_type'));
         $es->add_right_relationship($site_id, relationship_id_of('site_to_social_account'));
         $es->add_rel_sort_field($site_id, relationship_id_of('site_to_social_account'));
         $es->set_order('rel_sort_order ASC');
         $es->limit_tables();
         $es->limit_fields();
         if ($results = $es->run_one()) {
             $result_keys = array_keys($results);
             $sih = reason_get_social_integration_helper();
             foreach ($result_keys as $id) {
                 // get the integrator if it supports the SocialAccountProfileLinks interface
                 if ($integrator = $sih->get_social_account_integrator($id, 'SocialAccountProfileLinks')) {
                     $profile_links[$id]['icon'] = $integrator->get_profile_link_icon($id);
                     $profile_links[$id]['text'] = $integrator->get_profile_link_text($id);
                     $profile_links[$id]['href'] = $integrator->get_profile_link_href($id);
                 }
             }
             if (!empty($profile_links)) {
                 return $profile_links;
             }
         }
         return false;
     } else {
         trigger_error('The ReasonSocialProfileLinksModel must be provided with the configuration parameter site_id.', FATAL);
     }
 }
Example #8
0
 function query($sql, $unbuffered = false)
 {
     if (defined('LUNA_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
     } else {
         $this->query_result = @sqlite_query($this->link_id, $sql);
     }
     if ($this->query_result) {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @sqlite_last_error($this->link_id);
         $this->error_msg = @sqlite_error_string($this->error_no);
         if ($this->in_transaction) {
             @sqlite_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
Example #9
0
 public function query($sql, $unbuffered = false)
 {
     if (defined('FEATHER_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     $this->query_result = @mysqli_query($this->link_id, $sql);
     if ($this->query_result) {
         if (defined('FEATHER_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FEATHER_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysqli_errno($this->link_id);
         $this->error_msg = @mysqli_error($this->link_id);
         // Rollback transaction
         if ($this->in_transaction) {
             mysqli_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
Example #10
0
 function query($sql, $unbuffered = false)
 {
     if (strrpos($sql, 'LIMIT') !== false) {
         $sql = preg_replace('#LIMIT ([0-9]+),([ 0-9]+)#', 'LIMIT \\2 OFFSET \\1', $sql);
     }
     if (defined('PUN_SHOW_QUERIES')) {
         $q_start = get_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('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         $this->last_query_text[$this->query_result] = $sql;
         return $this->query_result;
     } else {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = false;
         $this->error_msg = @pg_result_error($this->query_result);
         if ($this->in_transaction) {
             @pg_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
Example #11
0
 public function query($sql, $memcache = false, $memcache_timeout = false)
 {
     if (!$this->useMemcache) {
         $memcache = false;
     }
     $start = get_microtime();
     $memcache_check = false;
     if ($memcache) {
         $result = $this->memcache->get($memcache, null, true);
         if ($result) {
             $memcache_check = true;
         }
     }
     if (!$memcache_check) {
         if (!$this->instance) {
             $this->connect();
         }
         $result = $this->instance->query($sql);
     }
     $end = get_microtime();
     if (!$result) {
         die("MySQL Error: " . $this->instance->error);
     }
     $log = array();
     $log['query'] = $sql;
     $log['time'] = number_format(round(($end - $start) * 1000, 4), 4);
     if ($memcache) {
         if ($memcache_check) {
             $log['memcache'] = 'get';
         } else {
             $log['memcache'] = 'add';
         }
     } else {
         $log['memcache'] = false;
     }
     array_push($this->query_log, $log);
     if ($memcache_check) {
         return $result;
     }
     if (strtoupper(substr(trim($sql), 0, 6)) == "SELECT") {
         $return_array = array();
         $return_array['result'] = array();
         $return_array['count'] = $result->num_rows;
         while ($row = $result->fetch_assoc()) {
             array_push($return_array['result'], $row);
         }
         if ($memcache) {
             $this->memcache->add($memcache, $return_array, false, $memcache_timeout ? $memcache_timeout : 0, true);
         }
         return $return_array;
     } elseif (strtoupper(substr(trim($sql), 0, 6)) == "INSERT") {
         return $this->instance->insert_id;
     } elseif (strtoupper(substr(trim($sql), 0, 6)) == "UPDATE") {
         return $this->instance->affected_rows;
     } else {
         return true;
     }
 }
Example #12
0
/**
* Footer
*
* To show footer of any page you want 
* paramenters : none
*/
function Saafooter($outscript = false)
{
    global $tpl, $SQL, $starttm, $config, $usrcp, $lang, $olang;
    global $do_gzip_compress, $script_encoding, $errorpage, $extras, $userinfo;
    //show stats ..
    $page_stats = '';
    if ($config['statfooter'] != 0) {
        $gzip = $config['gzip'] == '1' ? "Enabled" : "Disabled";
        $hksys = !defined('STOP_HOOKS') ? "Enabled" : "Disabled";
        $endtime = get_microtime();
        $loadtime = number_format($endtime - $starttm, 4);
        $queries_num = $SQL->query_num;
        $time_sql = round($SQL->query_num / $loadtime);
        $page_url = preg_replace(array('/([\\&\\?]+)debug/i', '/&/i'), array('', '&'), kleeja_get_page());
        $link_dbg = user_can('enter_acp') && $config['mod_writer'] != '1' ? '[ <a href="' . str_replace('&', '&amp;', $page_url) . (strpos($page_url, '?') === false ? '?' : '&amp;') . 'debug">More Details ... </a> ]' : null;
        $page_stats = "<strong>[</strong> GZIP : {$gzip} - Generation Time: {$loadtime} Sec  - Queries: {$queries_num} - Hook System:  {$hksys} <strong>]</strong>  " . $link_dbg;
    }
    $tpl->assign("page_stats", $page_stats);
    //if admin, show admin in the bottom of all page
    $tpl->assign("admin_page", user_can('enter_acp') ? '<a href="' . ADMIN_PATH . '" class="admin_cp_link"><span>' . $lang['ADMINCP'] . '</span></a>' : '');
    //assign cron
    $tpl->assign("run_queue", '<img src="' . $config['siteurl'] . 'go.php?go=queue" width="1" height="1" alt="queue" />');
    // if google analytics, new version
    //http://www.google.com/support/googleanalytics/bin/answer.py?answer=55488&topic=11126
    $googleanalytics = '';
    if (strlen($config['googleanalytics']) > 4) {
        $googleanalytics .= '<script type="text/javascript">' . "\n";
        $googleanalytics .= '<!--' . "\n";
        $googleanalytics .= 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");' . "\n";
        $googleanalytics .= 'document.write("\\<script src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'>\\<\\/script>" );' . "\n";
        $googleanalytics .= '-->' . "\n";
        $googleanalytics .= '</script>' . "\n";
        $googleanalytics .= '<script type="text/javascript">' . "\n";
        $googleanalytics .= '<!--' . "\n";
        $googleanalytics .= 'var pageTracker = _gat._getTracker("' . $config['googleanalytics'] . '");' . "\n";
        $googleanalytics .= 'pageTracker._initData();' . "\n";
        $googleanalytics .= 'pageTracker._trackPageview();' . "\n";
        $googleanalytics .= '-->' . "\n";
        $googleanalytics .= '</script>' . "\n";
    }
    $tpl->assign("googleanalytics", $googleanalytics);
    //check for extra header
    if (empty($extras['footer'])) {
        $extras['footer'] = false;
    }
    ($hook = kleeja_run_hook('func_Saafooter')) ? eval($hook) : null;
    //run hook
    $footer = $tpl->display("footer");
    ($hook = kleeja_run_hook('Saafooter_func')) ? eval($hook) : null;
    //run hook
    echo $footer;
    //page analysis
    if (isset($_GET['debug']) && user_can('enter_acp')) {
        kleeja_debug();
    }
    //at end, close sql connections
    $SQL->close();
}
Example #13
0
function print_version()
{
    global $time_start, $gzip, $PRINT_DEBUG, $tracker_version;
    $time_end = get_microtime();
    $max_mem = memory_get_peak_usage();
    print "<p align='center'>";
    if ($PRINT_DEBUG) {
        print "<small>[ Execution Time: " . number_format($time_end - $time_start, 4) . " sec. ] - [Memcached Queries: " . MCached::$count . " (" . round(MCached::$time, 4) . " sec.)] - [Memory Usage: " . misc::makesize($max_mem) . "]</small><br />";
    }
    print "BtiTracker (" . $tracker_version . ") by <a href='https://github.com/Yupy/BtiTracker-1.5.1' target='_blank'>Yupy</a> & <a href='http://www.btiteam.org' target='_blank'>Btiteam</a></p>";
}
Example #14
0
function render_page($license = false)
{
    global $aidlink, $locale, $settings, $colour_switcher, $fontsize_switcher, $main_style;
    echo "\n\t<div id='main' style='width: " . THEME_WIDTH . ";'>\n\t\t<div id='uborder' class='clearfix'>\n\t\t\t<div id='ucornerl' class='flleft'></div>\n\t\t\t<div id='ucornerr' class='flright'></div>\n\t\t</div>\n\t\t<div id='borderr'>\n\t\t\t<div id='borderl'>\n\t\t\t\t<div id='cont' class='clearfix {$main_style}'>\n\t\t\t\t\t<div id='userbar' class='floatfix'>\n\t\t\t\t\t\t<ul id='anchors' class='flleft'><li><a href='#Content'>" . $locale['global_210'] . "</a></li></ul>\n\t\t\t\t\t\t<ul id='links' class='clearfix flright'>\n";
    if (iMEMBER) {
        echo "\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "edit_profile.php'>" . $locale['global_120'] . "</a></li>\n\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "messages.php'>" . $locale['global_121'] . "</a></li>\n\t\t\t\t\t\t\t" . (iADMIN ? "<li><a href='" . ADMIN . "index.php" . $aidlink . "' >" . $locale['global_123'] . "</a></li>" : "") . "\n\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "setuser.php?logout=yes'>" . $locale['global_124'] . "</a></li>\n";
    } else {
        echo "\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "login.php'>" . $locale['global_104'] . "</a></li>\n\t\t\t\t\t\t\t" . ($settings['enable_registration'] ? "<li><a href='" . BASEDIR . "register.php'>" . $locale['global_107'] . "</a></li>\n" : "");
    }
    echo "\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id='mainheader' class='clearfix'>" . showbanners() . "</div>\n\t\t\t\t\t<div id='subheader' class='clearfix'>" . preg_replace("^(li)( class='(first-link)')*(><a href='(\\.\\./)*" . preg_quote(START_PAGE) . "')^i", "\\1 class='active \\3'\\4", showsublinks("")) . "\n\t\t\t\t\t\t" . $colour_switcher->makeForm("flright") . " \n\t\t\t\t\t\t" . $fontsize_switcher->makeForm("flright") . "\n\t\t\t\t\t</div>\n\t\t\t\t\t" . (LEFT ? "<div id='side-border-left'>" . LEFT . "</div>" : "") . "\n\t\t\t\t\t" . (RIGHT ? "<div id='side-border-right'>" . RIGHT . "</div>" : "") . "\n\t\t\t\t\t<div id='main-bg'><div id='container'>" . U_CENTER . CONTENT . L_CENTER . "\n\t\t\t\t\t</div></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id='lborder'>\n\t\t\t<div id='lcornerl' class='flleft'></div>\n\t\t\t<div id='lcornerr' class='flright'></div>\n\t\t</div>\n\t\t<div id='footer' class='clearfix'>\n\t\t\t" . (!$license ? "<div class='flleft' style='width: 50%'>" . showcopyright() . "<br />\n Theme designed by <a href='http://matonor.com'>Max Toball</a></div>" : "") . "\n\t\t\t<div class='flright' style='width: 50%; text-align: right;'>" . stripslashes($settings['footer']) . "</div>\n\t\t</div>\n\t\t<div id='subfooter' class='clearfix'>\n\t\t\t<div class='flleft' style='width: 50%'>" . sprintf($locale['global_172'], substr(get_microtime() - START_TIME, 0, 4)) . "</div>\n\t\t\t<div class='flright' style='width: 50%; text-align: right;'>" . showcounter() . "</div>\n\t\t</div>\n\t</div>";
}
Example #15
0
function print_version()
{
    global $time_start, $gzip, $PRINT_DEBUG, $tracker_version;
    $time_end = get_microtime();
    $max_mem = memory_get_peak_usage();
    print "<p align='center'>";
    if ($PRINT_DEBUG) {
        print "[ Execution time: " . number_format($time_end - $time_start, 4) . " sec. ] - [Memory usage: " . misc::makesize($max_mem) . "] - [ GZIP: " . $gzip . " ]<br />";
    }
    print "BtiTracker (" . $tracker_version . ") by <a href='https://github.com/Yupy/BtiTracker-1.5.0' target='_blank'>Yupy</a> & <a href='http://www.btiteam.org' target='_blank'>Btiteam</a></p>";
}
Example #16
0
function render_page($license = false)
{
    global $locale, $aidlink, $main_style, $settings;
    echo "<div id='main' style='width: " . THEME_WIDTH . "; left: 50%; margin-left: -47.5%;'>\n\t<div id='header'>\n\t\t<div id='userbar'>\n\t\t\t<ul id='anchors' class='flleft'><li><a href='#Content'>" . $locale['global_210'] . "</a></li></ul>\n\t\t\t<ul id='links' class='clearfix flright'>\n";
    if (iMEMBER) {
        echo "\t\t\t\n\t\t\t\t<li><img src='" . THEME . "images/profile.gif' alt='" . $locale['global_120'] . "' /><a href='" . BASEDIR . "edit_profile.php'>" . $locale['global_120'] . "</a></li>\n\t\t\t\t<li><img src='" . THEME . "images/pm.gif' alt='" . $locale['global_121'] . "' /><a href='" . BASEDIR . "messages.php'>" . $locale['global_121'] . "</a></li>\n\t\t\t\t" . (iADMIN ? "<li><img src='" . THEME . "images/admin.gif' alt='" . $locale['global_123'] . "' /><a href='" . ADMIN . "index.php" . $aidlink . "' >" . $locale['global_123'] . "</a></li>" : "") . "\n\t\t\t\t<li><img src='" . THEME . "images/logout.gif' alt='" . $locale['global_124'] . "' /><a href='" . BASEDIR . "setuser.php?logout=yes'>" . $locale['global_124'] . "</a></li>\n";
    } else {
        echo "\t\t\t<li><img src='" . THEME . "images/login.gif' alt='" . $locale['global_104'] . "' /><a href='" . BASEDIR . "login.php'>" . $locale['global_104'] . "</a></li>\n";
    }
    echo "\t\t</ul>\n\t\t</div>\n\t\t<div id='mainheader' class='clearfix'>\n\t\t\t<img src='" . THEME . "images/userbar_shadow.jpg' id='userbar_shadow' alt='---------' />\n\t\t\t" . showbanners() . "\n\t\t</div>\n\t\t<img src='" . THEME . "images/subheader_l.jpg' class='flleft' alt='' />\n\t\t<img src='" . THEME . "images/subheader_r.jpg' class='flright' alt='' />\n\t\t<div id='subheader' class='clearfix'>" . showsublinks(" ") . "</div>\n\t</div>\n\t<div id='cont' class='clearfix {$main_style}'>\n\t\t<img src='" . THEME . "images/side_tl.gif' id='side_tl' alt='' />\n\t\t<img src='" . THEME . "images/side_tr.gif' id='side_tr' alt='' />\n\n\t\t" . (LEFT ? "<div id='side-border-left'>" . LEFT . "</div>" : "") . "\n\t\t" . (RIGHT ? "<div id='side-border-right'>" . RIGHT . "</div>" : "") . "\n\t\t<div id='main-bg'><div id='container'>" . U_CENTER . CONTENT . L_CENTER . "\n\t\t</div></div>\n\t</div>\n\t<img src='" . THEME . "images/side_bl.jpg' class='flleft' alt='' />\n\t<img src='" . THEME . "images/side_br.jpg' class='flright' alt='' />\n\t<div id='cont_b'></div>\n\t<div id='footer' class='clearfix'>\n\t\t" . (!$license ? "<div class='flleft' style='width: 50%'>" . showcopyright() . "<br />\n Theme designed by <a href='http://matonor.com'>Max Toball</a></div>" : "") . "\n\t\t<div class='flright' style='width: 50%; text-align: right;'>" . stripslashes($settings['footer']) . "</div>\n";
    echo "\t</div>\n\t<div id='subfooter' class='clearfix'>\n\t\t<div class='flleft' style='width: 50%'>" . sprintf($locale['global_172'], substr(get_microtime() - START_TIME, 0, 4)) . "</div>\n\t\t<div class='flright' style='width: 50%; text-align: right;'>" . showcounter() . "</div>\n\t</div>\n</div>";
}
Example #17
0
 public function tokenize($test, $flag)
 {
     $flag = constant("HTML5_Tokenizer::{$flag}");
     if (!isset($test->lastStartTag)) {
         $test->lastStartTag = null;
     }
     $tokenizer = new HTML5_TestableTokenizer($test->input, $flag, $test->lastStartTag);
     $GLOBALS['TIME'] -= get_microtime();
     $tokenizer->parse();
     $GLOBALS['TIME'] += get_microtime();
     return $tokenizer->outputTokens;
 }
function dbresult($query, $row)
{
    global $mysql_queries_count, $mysql_queries_time;
    $query_time = get_microtime();
    $result = @mysql_result($query, $row);
    $query_time = substr(get_microtime() - $query_time, 0, 7);
    $mysql_queries_time[$mysql_queries_count] = array($query_time, $query);
    if (!$result) {
        echo mysql_error();
        return false;
    } else {
        return $result;
    }
}
Example #19
0
 public function invoke($test)
 {
     // this is totally the wrong interface to use, but
     // for now we need testing
     $tokenizer = new HTML5_Tokenizer($test['data']);
     $GLOBALS['TIME'] -= get_microtime();
     if (isset($test['document-fragment'])) {
         $tokenizer->parseFragment($test['document-fragment']);
     } else {
         $tokenizer->parse();
     }
     $GLOBALS['TIME'] += get_microtime();
     $this->assertIdentical($test['document'], HTML5_TestData::strDom($tokenizer->save()), $test);
 }
Example #20
0
 public function log($sql, array $params = null, array $types = null)
 {
     global $MAIN_CFG;
     $this->query_start_time = get_microtime();
     if (NEXOS_DEBUG || is_admin() && !empty($MAIN_CFG['debug']['database'])) {
         $failed = false;
         $this->_backtrace();
         $new_log['line'] = $this->line;
         $new_log['query'] = htmlprepare($sql);
         $new_log['params'] = htmlprepare($params);
         $new_log['types'] = htmlprepare($types);
         $new_log['failed'] = $failed;
         $this->query_list[$this->file][$this->num_queries] = $new_log;
     }
 }
function dbresult($query, $row)
{
    global $pdo, $mysql_queries_count, $mysql_queries_time;
    $query_time = get_microtime();
    $data = $query->fetchAll();
    $query_time = substr(get_microtime() - $query_time, 0, 7);
    $mysql_queries_time[$mysql_queries_count] = array($query_time, $query);
    if (!$query) {
        print_r($query->errorInfo());
        return FALSE;
    } else {
        $result = $query->getColumnMeta(0);
        return $data[$row][$result['name']];
    }
}
Example #22
0
/**
 * Print footer part of the page
 *
 * @return void
 */
function kleeja_footer()
{
    global $SQL, $starttm, $config, $user, $lang, $extras, $plugin;
    #show stats ..
    $page_stats = false;
    if ($config['statfooter'] != 0 || DEV_STAGE) {
        $hksys = !defined('STOP_HOOKS') ? 'Enabled' : 'Disabled';
        $endtime = get_microtime();
        $loadtime = number_format($endtime - $starttm, 4);
        $queries_num = $SQL->query_num;
        $time_sql = round($SQL->query_num / $loadtime);
        $time_zone = (strpos($config['time_zone'], '-') !== false ? '' : '+') . $config['time_zone'];
        $page_stats = "<strong>[</strong> Generation Time: {$loadtime} Sec  - Queries: {$queries_num} - Hook System:  {$hksys} - Time Zone: UTC{$time_zone}<strong> ]</strong>  ";
    }
    #if google analytics is enabled, show it
    $google_analytics = false;
    if (strlen($config['googleanalytics']) > 4) {
        $google_analytics .= '<script type="text/javascript">' . "\n";
        $google_analytics .= '<!--' . "\n";
        $google_analytics .= 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");' . "\n";
        $google_analytics .= 'document.write("\\<script src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'>\\<\\/script>" );' . "\n";
        $google_analytics .= '-->' . "\n";
        $google_analytics .= '</script>' . "\n";
        $google_analytics .= '<script type="text/javascript">' . "\n";
        $google_analytics .= '<!--' . "\n";
        $google_analytics .= 'var pageTracker = _gat._getTracker("' . $config['googleanalytics'] . '");' . "\n";
        $google_analytics .= 'pageTracker._initData();' . "\n";
        $google_analytics .= 'pageTracker._trackPageview();' . "\n";
        $google_analytics .= '-->' . "\n";
        $google_analytics .= '</script>' . "\n";
    }
    #check for extra header
    if (empty($extras['footer'])) {
        $extras['footer'] = false;
    }
    ($hook = $plugin->run_hook('kleeja_footer_func')) ? eval($hook) : null;
    //run hook
    $k = '<div sty' . 'le="di' . 'spl' . 'ay:bl' . 'oc' . 'k !im' . 'po' . 'rt' . 'ant;' . 'backgrou' . 'nd:#ECE' . 'CE' . 'C !im' . 'po' . 'rt' . 'ant;margin:5p' . 'x; padding:2px 3px; position:fi' . 'xed;bottom' . ':0px;left:1%' . ';z-index:9' . '9999;text' . '-align:center;">P' . 'owe' . 'red b' . 'y <a style="di' . 'spl' . 'ay:in' . 'li' . 'ne  !im' . 'po' . 'rt' . 'ant;' . 'color:#6' . '2B4E8 !im' . 'po' . 'rt' . 'ant;" href="http:' . '/' . '/ww' . 'w.kl' . 'ee' . 'ja.c' . 'om/" onclic' . 'k="windo' . 'w.op' . 'en(this.h' . 'ref,' . '\'_b' . 'lank\');retur' . 'n false;" title' . '="K' . 'lee' . 'ja">K' . 'lee' . 'ja</a></div>' . "\n";
    $v = @unserialize($config['new_version']);
    if ((int) $v[strip_tags('co<!--it-->py<!--made-->ri<!--for-->gh<!--you-->ts<!--yub-->')] == 0) {
        echo $k;
    }
    include get_template_path('footer.php');
    #at end, close sql connections & etc
    garbage_collection();
}
Example #23
0
 function query($sql = '', $transaction = 0)
 {
     unset($this->query_result);
     if ($sql != '') {
         if (defined('PUN_SHOW_QUERIES')) {
             $q_start = get_microtime();
         }
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         unset($this->row[$this->query_result]);
         return $this->query_result;
     } else {
         return $transaction == PUN_TRANS_END ? true : false;
     }
 }
Example #24
0
 function query($sql, $unbuffered = false)
 {
     if ($unbuffered) {
         $this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
     } else {
         $this->query_result = @sqlite_query($this->link_id, $sql);
     }
     if ($this->query_result) {
         if (defined('EPS_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         return $this->query_result;
     } else {
         if (defined('EPS_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @sqlite_last_error($this->link_id);
         $this->error_msg = @sqlite_error_string($this->error_no);
         return false;
     }
 }
Example #25
0
function render_page($license = false)
{
    global $settings, $main_style, $locale;
    //Header
    echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
    echo "<td class='full-header'>\n" . showbanners() . "</td>\n";
    echo "</tr>\n</table>\n";
    echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
    echo "<td class='sub-header-left'></td>\n";
    echo "<td class='sub-header'>" . showsublinks(" " . THEME_BULLET . " ", "white") . "</td>\n";
    echo "<td align='right' class='sub-header'>" . showsubdate() . "</td>\n";
    echo "<td class='sub-header-right'></td>\n";
    echo "</tr>\n</table>\n";
    //Content
    echo "<table cellpadding='0' cellspacing='0' width='100%' class='{$main_style}'>\n<tr>\n";
    if (LEFT) {
        echo "<td class='side-border-left' valign='top'>" . LEFT . "</td>";
    }
    echo "<td class='main-bg' valign='top'>" . U_CENTER . CONTENT . L_CENTER . "</td>";
    if (RIGHT) {
        echo "<td class='side-border-right' valign='top'>" . RIGHT . "</td>";
    }
    echo "</tr>\n</table>\n";
    //Footer
    echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
    echo "<td class='sub-header-left'></td>\n";
    echo "<td align='left' class='sub-header'>" . sprintf($locale['global_172'], substr(get_microtime() - START_TIME, 0, 4)) . "</td>\n";
    echo "<td align='right' class='sub-header'>" . showcounter() . "</td>\n";
    echo "<td class='sub-header-right'></td>\n";
    echo "</tr>\n</table>\n";
    echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
    echo "<td align='center' class='main-footer'>" . stripslashes($settings['footer']);
    if (!$license) {
        echo "<br /><br />\n" . showcopyright();
    }
    echo "</td>\n";
    echo "</tr>\n</table>\n";
}
Example #26
0
function footmsg()
{
    global $db, $dbal, $foot1, $foot2, $foot3, $total_time, $start_mem;
    if ($foot1 != '') {
        $foot1 .= '<br />' . "\n";
    }
    if ($foot2 != '') {
        $foot1 .= $foot2 . '<br />' . "\n";
    }
    if ($foot3 != '') {
        $foot1 .= $foot3 . '<br />' . "\n";
    }
    if (is_admin()) {
        $db_log = $dbal->getConfiguration()->getSQLLogger();
        $end_time = get_microtime();
        $total_time = $end_time - START_TIME - $db->time;
        $new_total_time = $end_time - START_TIME - $db_log->time;
        $foot1 .= sprintf(_PAGEFOOTER, round($total_time, 4) . '|' . round($new_total_time, 4), $db->num_queries . '|' . $db_log->num_queries, round($db->time, 4) . '|' . round($db_log->time, 4));
        // only works if your PHP is compiled with the --enable-memory-limit configuration option
        if (function_exists('memory_get_usage') && $start_mem > 0) {
            $total_mem = memory_get_usage() - $start_mem;
            $foot1 .= '<br />Memory Usage: ' . ($total_mem >= 1048576 ? round(round($total_mem / 1048576 * 100) / 100, 2) . ' MB' : ($total_mem >= 1024 ? round(round($total_mem / 1024 * 100) / 100, 2) . ' KB' : $total_mem . ' Bytes'));
        }
        $foot1 .= '<br />';
    }
    // MS-Analysis Entry
    //	  require( "modules/MS_Analysis/mstrack.php" );
    $foot1 = '<div style="text-align:center;">' . $foot1 . '
	Interactive software released under <a href="http://dragonflycms.org/GNUGPL.html" target="_blank" title="GNU Public License Agreement">GNU GPL</a>,
	<a href="' . URL::index('credits') . '">Code Credits</a>,
	<a href="' . URL::index('privacy_policy') . '">Privacy Policy</a></div>';
    if (is_admin() || NEXOS_DEBUG) {
        $GLOBALS['cpgtpl']->assign_var('S_DEBUG_SQL', NEXOS_DEBUG || $GLOBALS['MAIN_CFG']['debug']['database'] ? $GLOBALS['cpgdebugger']->get_report('sql') : false);
        $GLOBALS['cpgtpl']->assign_var('S_DEBUG_PHP', $GLOBALS['cpgdebugger']->get_report('php'));
    }
    return $foot1;
}
function standardheader($title, $normalpage = true, $idlang = 0)
{
    global $SITENAME, $STYLEPATH, $USERLANG, $time_start, $gzip, $GZIP_ENABLED, $err_msg_install, $db;
    $time_start = get_microtime();
    // default settings for blocks/menu
    if (!isset($GLOBALS["charset"])) {
        $GLOBALS["charset"] = "iso-8859-1";
    }
    // controll if client can handle gzip
    if ($GZIP_ENABLED && user::$current['uid'] > 1) {
        if (stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") && extension_loaded('zlib') && ini_get("zlib.output_compression") == 0) {
            if (ini_get('output_handler') != 'ob_gzhandler') {
                ob_start("ob_gzhandler");
                $gzip = 'enabled';
            } else {
                ob_start();
                $gzip = 'enabled';
            }
        } else {
            ob_start();
            $gzip = 'disabled';
        }
    } else {
        $gzip = 'disabled';
    }
    header("Content-Type: text/html; charset=" . $GLOBALS["charset"]);
    if ($title == "") {
        $title = unesc($SITENAME);
    } else {
        $title = unesc($SITENAME) . " - " . security::html_safe($title);
    }
    ?>
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html><head>
    <title>
	<?php 
    echo $title;
    ?>
	</title>
    <?php 
    // get user's style
    $resheet = $db->query("SELECT * FROM style WHERE id = " . user::$current["style"]);
    if (!$resheet) {
        $STYLEPATH = "./style/base";
        $style = "./style/base/torrent.css";
    } else {
        $resstyle = $resheet->fetch_array(MYSQLI_BOTH);
        $STYLEPATH = $resstyle["style_url"];
        $style = $resstyle["style_url"] . "/torrent.css";
    }
    print "<link rel='stylesheet' href='" . $style . "' type='text/css' />";
    print "<link rel='stylesheet' href='style/base/ui.css' type='text/css' />";
    ?>
    </head>
    <body>
    <?php 
    // getting user language
    if ($idlang == 0) {
        $reslang = $db->query("SELECT * FROM language WHERE id = " . user::$current["language"]);
    } else {
        $reslang = $db->query("SELECT * FROM language WHERE id={$idlang}");
    }
    if (!$reslang) {
        $USERLANG = "language/english.php";
    } else {
        $rlang = $reslang->fetch_array(MYSQLI_BOTH);
        $USERLANG = "" . $rlang["language_url"];
    }
    clearstatcache();
    if (!file_exists($USERLANG)) {
        err_msg("Error!", "Missing Language!");
        print_version();
        print "</body>\n</html>\n";
        die;
    }
    require_once $USERLANG;
    if (!file_exists($style)) {
        err_msg("Error!", "Missing Style!");
        print_version();
        print "</body>\n</html>\n";
        die;
    }
    if ($normalpage) {
        require_once $STYLEPATH . "/header.php";
    }
    echo $err_msg_install;
}
Example #28
0
if (!defined('FORUM')) {
    header('Location: install.php');
    exit;
}
// Load the functions script
require FORUM_ROOT . 'include/functions.php';
// Load the security functions
require FORUM_ROOT . 'include/class/luna_nonces.php';
// Load UTF-8 functions
require FORUM_ROOT . 'include/utf8/utf8.php';
// Strip out "bad" UTF-8 characters
forum_remove_bad_characters();
// Reverse the effect of register_globals
forum_unregister_globals();
// Record the start time (will be used to calculate the generation time for the page)
$luna_start = get_microtime();
// Make sure PHP reports all errors except E_NOTICE. Luna supports E_ALL, but a lot of scripts it may interact with, do not
error_reporting(E_ALL ^ E_NOTICE);
// Force POSIX locale (to prevent functions such as strtolower() from messing up UTF-8 strings)
setlocale(LC_CTYPE, 'C');
// Turn off magic_quotes_runtime
if (get_magic_quotes_runtime()) {
    set_magic_quotes_runtime(0);
}
// Strip slashes from GET/POST/COOKIE/REQUEST/FILES (if magic_quotes_gpc is enabled)
if (!defined('FORUM_DISABLE_STRIPSLASHES') && get_magic_quotes_gpc()) {
    function stripslashes_array($array)
    {
        return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
    }
    $_GET = stripslashes_array($_GET);
Example #29
0
                 break;
             default:
                 $str .= "1=0";
                 // 항상 거짓
                 break;
         }
         $op2 = " or ";
     }
     $str .= ")";
     $op1 = " {$sop} ";
 }
 $str .= ")";
 $sql_search = $str;
 $str_board_list = "";
 $board_count = 0;
 $time1 = get_microtime();
 $total_count = 0;
 for ($i = 0; $i < count($g5_search['tables']); $i++) {
     $tmp_write_table = $g5['write_prefix'] . $g5_search['tables'][$i];
     $sql = " select wr_id from {$tmp_write_table} where {$sql_search} ";
     $result = sql_query($sql, false);
     $row['cnt'] = @mysql_num_rows($result);
     $total_count += $row['cnt'];
     if ($row['cnt']) {
         $board_count++;
         $search_table[] = $g5_search['tables'][$i];
         $read_level[] = $g5_search['read_level'][$i];
         $search_table_count[] = $total_count;
         $sql2 = " select bo_subject from {$g5['board_table']} where bo_table = '{$g5_search['tables'][$i]}' ";
         $row2 = sql_fetch($sql2);
         $sch_class = "";
Example #30
0
File: d.php Project: NewMyCMS/MyCMS
<link rel="stylesheet" href="template/default/css/s.css" type="text/css"/>
<script href=""></script>
</head>
<body style="margin:400px 100px;font-size:80px;line-height:400px;">
<?php 
function get_microtime()
{
    list($usec, $sec) = explode(' ', microtime());
    return (double) $usec + (double) $sec;
}
$startime = get_microtime();
for ($i = 0; $i < 10000; $i++) {
    echo $a, $b, $c, $d, $e, $f, $g;
}
echo '<br>', get_microtime() - $startime, '<br>';
//
$startime = get_microtime();
for ($i = 0; $i < 10000; $i++) {
    $h = $a . $b . $c . $d . $e . $f . $g;
    echo $h;
}
echo '<br>', get_microtime() - $startime, '<br>';
//
$startime = get_microtime();
for ($i = 0; $i < 10000; $i++) {
    echo "{$a}{$b}{$c}{$d}{$e}{$f}{$g}";
}
echo '<br>', get_microtime() - $startime;
?>
</body>
</html>