本文整理匯總了PHP中IPSDebug::endTimer方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSDebug::endTimer方法的具體用法?PHP IPSDebug::endTimer怎麽用?PHP IPSDebug::endTimer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSDebug
的用法示例。
在下文中一共展示了IPSDebug::endTimer方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: query
/**
* Execute a direct database query
*
* @param string Database query
* @param boolean [Optional] Do not convert table prefix
* @return @e resource
*/
public function query($the_query, $bypass = false)
{
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['debug'] or $this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log']) {
IPSDebug::startTimer();
$_MEMORY = IPSDebug::getMemoryDebugFlag();
}
//-----------------------------------------
// Stop sub selects? (UNION)
//-----------------------------------------
if (!IPS_DB_ALLOW_SUB_SELECTS) {
# On the spot allowance?
if (!$this->allow_sub_select) {
$_tmp = strtolower($this->_removeAllQuotes($the_query));
if (preg_match("#(?:/\\*|\\*/)#i", $_tmp)) {
$this->throwFatalError("You are not allowed to use comments in your SQL query.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
return false;
}
if (preg_match("#[^_a-zA-Z]union[^_a-zA-Z]#s", $_tmp)) {
$this->throwFatalError("UNION query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
return false;
} else {
if (preg_match_all("#[^_a-zA-Z](select)[^_a-zA-Z]#s", $_tmp, $matches)) {
if (count($matches) > 1) {
$this->throwFatalError("SUB SELECT query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
return false;
}
}
}
}
}
//-----------------------------------------
// Run the query
//-----------------------------------------
$this->_tmpQ = substr($the_query, 0, 100) . '...';
$this->query_id = mysqli_query($this->connection_id, $the_query);
//-----------------------------------------
// Reset array...
//-----------------------------------------
$this->resetDataTypes();
$this->allow_sub_select = false;
if (!$this->query_id) {
$this->throwFatalError("mySQL query error: {$the_query}");
}
//-----------------------------------------
// Logging?
//-----------------------------------------
if ($this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log'] or $this->obj['use_slow_log'] and $this->obj['slow_log']) {
$endtime = IPSDebug::endTimer();
$_data = '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysqli_query($this->connection_id, "EXPLAIN {$the_query}");
$_bad = false;
while ($array = mysqli_fetch_array($eid)) {
$array['extra'] = isset($array['extra']) ? $array['extra'] : '';
$_data .= "\n+------------------------------------------------------------------------------+";
$_data .= "\n|Table: " . $array['table'];
$_data .= "\n|Type: " . $array['type'];
$_data .= "\n|Possible Keys: " . $array['possible_keys'];
$_data .= "\n|Key: " . $array['key'];
$_data .= "\n|Key Len: " . $array['key_len'];
$_data .= "\n|Ref: " . $array['ref'];
$_data .= "\n|Rows: " . $array['rows'];
$_data .= "\n|Extra: " . $array['Extra'];
//$_data .= "\n+------------------------------------------------------------------------------+";
if ($this->obj['use_bad_log'] and $this->obj['bad_log'] and (stristr($array['Extra'], 'filesort') or stristr($array['Extra'], 'temporary'))) {
$this->writeDebugLog($the_query, $_data, $endtime, $this->obj['bad_log'], TRUE);
}
if ($this->obj['use_slow_log'] and $this->obj['slow_log'] and $endtime >= $this->obj['use_slow_log']) {
$this->writeDebugLog($the_query, $_data, $endtime, $this->obj['slow_log'], TRUE);
}
}
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$this->writeDebugLog($the_query, $_data, $endtime);
}
} else {
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$this->writeDebugLog($the_query, $_data, $endtime);
}
}
}
//-----------------------------------------
// Debugging?
//-----------------------------------------
if ($this->obj['debug']) {
$endtime = IPSDebug::endTimer();
$memoryUsed = IPSDebug::setMemoryDebugFlag('', $_MEMORY);
$memory = '';
$shutdown = $this->is_shutdown ? 'SHUTDOWN QUERY: ' : '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysqli_query($this->connection_id, "EXPLAIN {$the_query}");
//.........這裏部分代碼省略.........
示例2: fetchOutput
/**
* Fetches the output
*
* @access public
* @param string Output gathered
* @param string Title of the document
* @param array Navigation gathered
* @param array Array of document head items
* @param array Array of JS loader items
* @param array Array of extra data
* @return string Output to be printed to the client
*/
public function fetchOutput($output, $title, $navigation, $documentHeadItems, $jsLoaderItems, $extraData = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$system_vars_cache = $this->caches['systemvars'];
$pmData = FALSE;
$notificationLatest = array();
//-----------------------------------------
// NORMAL
//-----------------------------------------
if ($this->_outputType == 'normal') {
//-----------------------------------------
// Do we have a notification show?
//-----------------------------------------
if (!empty($this->memberData['msg_show_notification']) and $this->memberData['_cache']['show_notification_popup']) {
if (!$this->settings['board_offline'] or $this->memberData['g_access_offline']) {
if (strpos(ipsRegistry::$settings['query_string_real'], 'module=messaging') === false) {
IPSMember::save($this->memberData['member_id'], array('core' => array('msg_show_notification' => 0)));
/* Grab inline notifications... */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
$notifyLibrary = new $classToLoad($this->registry);
$notifyLibrary->setMember($this->memberData);
$tmp = $notifyLibrary->getLatestNotificationForInlinePopUp();
$weNeed = array('notify_title', 'member_member_id', 'member_PhotoTag', 'member_members_display_name', 'date_parsed', 'title', 'url', 'type', 'content', 'member_HoverCard');
foreach ($weNeed as $k) {
$notificationLatest[$k] = $tmp[$k];
}
}
}
}
//-----------------------------------------
// Add identifier URL
//-----------------------------------------
$http = 'http://';
if (strpos($this->settings['board_url'], 'https://') === 0) {
$http = 'https://';
}
$this->addMetaTag('identifier-url', $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
//-----------------------------------------
// Add in task image?
//-----------------------------------------
$task = '';
$system_vars_cache['task_next_run'] = isset($system_vars_cache['task_next_run']) ? $system_vars_cache['task_next_run'] : 0;
if (!$this->settings['task_use_cron'] and time() >= $system_vars_cache['task_next_run'] or defined('FORCE_TASK_KEY')) {
$_url = !$this->registry->getClass('output')->isHTTPS ? $this->settings['base_url'] : $this->settings['base_url_https'];
$task = "<div><img src='" . $_url . "app=core&module=task' alt='' style='border: 0px;height:1px;width:1px;' /></div>";
}
//-----------------------------------------
// Grab output
//-----------------------------------------
/* Inline msg */
$inlineMsg = $this->member->sessionClass()->getInlineMessage();
$templateName = 'globalTemplate';
$templateGroup = 'global';
if ($this->useMinimalWrapper) {
$templateName = 'globalTemplateMinimal';
$templateGroup = 'global_other';
}
/* Do pagination */
if (strstr($title, '<%pageNumber%>')) {
$replace = $this->_current_page_title ? ' ' . $this->lang->words['page_title_page'] . ' ' . $this->_current_page_title : '';
$title = str_replace('<%pageNumber%>', $replace, $title);
} else {
if ($this->_current_page_title) {
$title = $title . ' ' . $this->lang->words['page_title_page'] . ' ' . $this->_current_page_title;
}
}
$finalOutput = $this->output->getTemplate($templateGroup)->{$templateName}($output, $documentHeadItems, $this->_css, $jsLoaderItems, $this->_metaTags, array('title' => $title, 'applications' => $this->core_fetchApplicationData(), 'page' => $this->_current_page_title, 'notifications' => $notificationLatest ? IPSText::jsonEncodeForTemplate($notificationLatest) : '', 'inlineMsg' => $inlineMsg), array('navigation' => $navigation, 'adHeaderCode' => !empty($extraData['adHeaderCode']) ? $extraData['adHeaderCode'] : '', 'adFooterCode' => !empty($extraData['adFooterCode']) ? $extraData['adFooterCode'] : ''), array('time' => $this->registry->getClass('class_localization')->getDate(time(), 'SHORT', 1), 'mark_read_apps' => IPSLib::getEnabledApplications('itemMarking'), 'lang_chooser' => $this->html_buildLanguageDropDown(), 'skin_chooser' => $this->html_fetchSetsDropDown(), 'copyright' => $this->html_fetchCopyright()), array('ex_time' => (isset($this->request['faster']) and $this->request['faster'] == 'yes') ? $this->_getFasterText() : sprintf("%.4f", IPSDebug::endTimer()), 'gzip_status' => $this->settings['disable_gzip'] == 1 ? $this->lang->words['gzip_off'] : $this->lang->words['gzip_on'], 'server_load' => ipsRegistry::$server_load, 'queries' => $this->DB->getQueryCount(), 'task' => $task));
} else {
if ($this->_outputType == 'redirect') {
$extraData['full'] = 1;
# SEO?
if ($extraData['seoTitle']) {
$extraData['url'] = $this->output->buildSEOUrl($extraData['url'], 'none', $extraData['seoTitle'], $extraData['seoTemplate']);
}
$finalOutput = $this->output->getTemplate('global_other')->redirectTemplate($documentHeadItems, $this->_css, $jsLoaderItems, $extraData['text'], $extraData['url'], $extraData['full']);
} else {
if ($this->_outputType == 'popup') {
$finalOutput = $this->output->getTemplate('global_other')->displayPopUpWindow($documentHeadItems, $this->_css, $jsLoaderItems, $title, $output);
}
}
}
//-----------------------------------------
// Set a class on the body for print
//-----------------------------------------
if ($this->_printOnly) {
$finalOutput = str_replace("<body", "<body class='printpreview'", $finalOutput);
//.........這裏部分代碼省略.........
示例3: fetchOutput
/**
* Fetches the output
*
* @access public
* @param string Output gathered
* @param string Title of the document
* @param array Navigation gathered
* @param array Array of document head items
* @param array Array of JS loader items
* @param array Array of extra data
* @return string Output to be printed to the client
*/
public function fetchOutput($output, $title, $navigation, $documentHeadItems, $jsLoaderItems, $extraData = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$system_vars_cache = $this->caches['systemvars'];
$showPMBox = '';
$currentCharSet = $this->settings['gb_char_set'];
/* Force UTF-8 for the skin */
$this->settings['gb_char_set'] = 'UTF-8';
//-----------------------------------------
// NORMAL
//-----------------------------------------
if ($this->_outputType == 'normal') {
//-----------------------------------------
// Grab output
//-----------------------------------------
$finalOutput = $this->output->getTemplate('global')->globalTemplate($output, $documentHeadItems, $this->_css, $jsLoaderItems, $this->_metaTags, array('title' => $title, 'applications' => $this->core_fetchApplicationData(), 'page' => $this->_current_page_title), array('navigation' => $navigation), array('time' => $this->registry->getClass('class_localization')->getDate(time(), 'SHORT', 1), 'lang_chooser' => $this->html_buildLanguageDropDown(), 'skin_chooser' => $this->html_fetchSetsDropDown(), 'stats' => $this->html_showDebugInfo(), 'copyright' => $this->html_fetchCopyright()), array('ex_time' => sprintf("%.4f", IPSDebug::endTimer()), 'gzip_status' => $this->settings['disable_gzip'] == 1 ? $this->lang->words['gzip_off'] : $this->lang->words['gzip_on'], 'server_load' => ipsRegistry::$server_load, 'queries' => $this->DB->getQueryCount()));
} else {
if ($this->_outputType == 'redirect') {
# SEO?
if ($extraData['seoTitle']) {
$extraData['url'] = $this->output->buildSEOUrl($extraData['url'], 'none', $extraData['seoTitle']);
$extraData['full'] = 1;
}
$finalOutput = $this->output->getTemplate('global')->redirectTemplate($documentHeadItems, $this->_css, $jsLoaderItems, $extraData['text'], $extraData['url'], $extraData['full']);
} else {
if ($this->_outputType == 'popup') {
$finalOutput = $this->output->getTemplate('global')->displayPopUpWindow($documentHeadItems, $this->_css, $jsLoaderItems, $title, $output);
}
}
}
//-----------------------------------------
// Return
//-----------------------------------------
$finalOutput = $this->parseIPSTags($finalOutput);
/* Attempt to clean HTML */
return IPSText::stripNonUtf8(IPSText::convertCharsets($finalOutput, $currentCharSet, 'UTF-8'));
}
示例4: fetchOutput
/**
* Fetches the output
*
* @access public
* @param string Output gathered
* @param string Title of the document
* @param array Navigation gathered
* @param array Array of document head items
* @param array Array of JS loader items
* @param array Array of extra data
* @return string Output to be printed to the client
*/
public function fetchOutput($output, $title, $navigation, $documentHeadItems, $jsLoaderItems, $extraData = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$system_vars_cache = $this->caches['systemvars'];
$pmData = FALSE;
//-----------------------------------------
// NORMAL
//-----------------------------------------
if ($this->_outputType == 'normal') {
//-----------------------------------------
// Do we have a PM show?
//-----------------------------------------
if (($this->memberData['msg_count_reset'] or $this->memberData['msg_show_notification']) and !$this->memberData['members_disable_pm']) {
IPSMember::save($this->memberData['member_id'], array('core' => array('msg_show_notification' => 0)));
if ($this->request['module'] != 'messaging' and (!$this->settings['board_offline'] or $this->memberData['g_access_offline'])) {
/* Grab PM Data. We init if we need to recount... */
require_once IPSLib::getAppDir("members") . '/sources/classes/messaging/messengerFunctions.php';
$messengerFunctions = new messengerFunctions($this->registry);
/* Only collect data if we have notifications to show */
if ($this->memberData['msg_show_notification']) {
$_data = $messengerFunctions->fetchUnreadNotifications($this->memberData['member_id']);
if (count($_data)) {
$pmData = array_shift($_data);
}
}
}
}
//-----------------------------------------
// Add identifier URL
//-----------------------------------------
$this->addMetaTag('identifier-url', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
//-----------------------------------------
// Add in task image?
//-----------------------------------------
$task = '';
$system_vars_cache['task_next_run'] = isset($system_vars_cache['task_next_run']) ? $system_vars_cache['task_next_run'] : 0;
if (time() >= $system_vars_cache['task_next_run']) {
$_url = !$this->registry->getClass('output')->isHTTPS ? $this->settings['base_url'] : $this->settings['base_url_https'];
$task = "<div><img src='" . $_url . "app=core&module=task' alt='' style='border: 0px;height:1px;width:1px;' /></div>";
}
//-----------------------------------------
// Grab output
//-----------------------------------------
$finalOutput = $this->output->getTemplate('global')->globalTemplate($output, $documentHeadItems, $this->_css, $jsLoaderItems, $this->_metaTags, array('title' => $title, 'applications' => $this->core_fetchApplicationData(), 'page' => $this->_current_page_title), array('navigation' => $navigation, 'pmData' => $pmData), array('time' => $this->registry->getClass('class_localization')->getDate(time(), 'SHORT', 1), 'lang_chooser' => $this->html_buildLanguageDropDown(), 'skin_chooser' => $this->html_fetchSetsDropDown(), 'copyright' => $this->html_fetchCopyright()), array('ex_time' => sprintf("%.4f", IPSDebug::endTimer()), 'gzip_status' => $this->settings['disable_gzip'] == 1 ? $this->lang->words['gzip_off'] : $this->lang->words['gzip_on'], 'server_load' => ipsRegistry::$server_load, 'queries' => $this->DB->getQueryCount(), 'task' => $task));
} else {
if ($this->_outputType == 'redirect') {
$extraData['full'] = 1;
# SEO?
if ($extraData['seoTitle']) {
$extraData['url'] = $this->output->buildSEOUrl($extraData['url'], 'none', $extraData['seoTitle']);
}
$finalOutput = $this->output->getTemplate('global_other')->redirectTemplate($documentHeadItems, $this->_css, $jsLoaderItems, $extraData['text'], $extraData['url'], $extraData['full']);
} else {
if ($this->_outputType == 'popup') {
$finalOutput = $this->output->getTemplate('global_other')->displayPopUpWindow($documentHeadItems, $this->_css, $jsLoaderItems, $title, $output);
}
}
}
//-----------------------------------------
// Return
//-----------------------------------------
//print IPSLib::sizeFormat( IPSLib::strlenToBytes( strlen( $finalOutput ) ) );
return $this->parseIPSTags($finalOutput);
}
示例5: query
/**
* Execute a direct database query
*
* @access public
* @param string Database query
* @param boolean [Optional] Do not convert table prefix
* @return resource Query id
*/
public function query($the_query, $bypass = false)
{
//-----------------------------------------
// Change the table prefix if needed
//-----------------------------------------
if ($this->no_prefix_convert) {
$bypass = 1;
}
if (!$bypass) {
if ($this->obj['sql_tbl_prefix'] != "ibf_" and !$this->prefix_changed) {
//$the_query = preg_replace("/\sibf_(\S+?)([\s\.,]|$)/", " ".$this->obj['sql_tbl_prefix']."\\1\\2", $the_query);
}
}
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['debug'] or $this->obj['use_debug_log'] and $this->obj['debug_log']) {
IPSDebug::startTimer();
}
//-----------------------------------------
// Stop sub selects? (UNION)
//-----------------------------------------
if (!IPS_DB_ALLOW_SUB_SELECTS) {
# On the spot allowance?
if (!$this->allow_sub_select) {
$_tmp = strtolower($this->_removeAllQuotes($the_query));
if (preg_match("#(?:/\\*|\\*/)#i", $_tmp)) {
$this->throwFatalError("You are not allowed to use comments in your SQL query.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them\n{$the_query}");
return false;
}
if (preg_match("#[^_a-zA-Z]union[^_a-zA-Z]#s", $_tmp)) {
$this->throwFatalError("UNION query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them\n{$the_query}");
return false;
} else {
if (preg_match_all("#[^_a-zA-Z](select)[^_a-zA-Z]#s", $_tmp, $matches)) {
if (count($matches) > 1) {
$this->throwFatalError("SUB SELECT query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them\n{$the_query}");
return false;
}
}
}
}
}
//-----------------------------------------
// Run the query
//-----------------------------------------
#I had to switch this around... The query goes first, connection id second. Otherwise it just breaks - KF
#$this->query_id = mysql_query($this->connection_id, $the_query );
$this->query_id = mysql_query($the_query, $this->connection_id);
//-----------------------------------------
// Reset array...
//-----------------------------------------
$this->force_data_type = array();
$this->allow_sub_select = false;
if (!$this->query_id) {
$this->throwFatalError("mySQL query error: {$the_query}");
}
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$endtime = IPSDebug::endTimer();
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysql_query("EXPLAIN {$the_query}", $this->connection_id);
while ($array = mysql_fetch_array($eid)) {
$_data .= "\n+------------------------------------------------------------------------------+";
$_data .= "\n|Table: " . $array['table'];
$_data .= "\n|Type: " . $array['type'];
$_data .= "\n|Possible Keys: " . $array['possible_keys'];
$_data .= "\n|Key: " . $array['key'];
$_data .= "\n|Key Len: " . $array['key_len'];
$_data .= "\n|Ref: " . $array['ref'];
$_data .= "\n|Rows: " . $array['rows'];
$_data .= "\n|Extra: " . $array['extra'];
$_data .= "\n+------------------------------------------------------------------------------+";
}
$this->writeDebugLog($the_query, $_data, $endtime);
} else {
$this->writeDebugLog($the_query, $_data, $endtime);
}
} else {
if ($this->obj['debug']) {
$endtime = IPSDebug::endTimer();
$shutdown = $this->is_shutdown ? 'SHUTDOWN QUERY: ' : '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysql_query("EXPLAIN {$the_query}", $this->connection_id);
$this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>\n\t\t\t\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t\t\t\t \t <td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>{$shutdown}Select Query</b></td>\n\t\t\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t\t\t\t <td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>{$the_query}</td>\n\t\t\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t\t\t\t <tr bgcolor='#FFC5Cb'>\n\t\t\t\t\t\t\t\t\t\t\t <td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>\n\t\t\t\t\t\t\t\t\t\t\t <td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>\n\t\t\t\t\t\t\t\t\t\t\t <td><b>rows</b></td><td><b>Extra</b></td>\n\t\t\t\t\t\t\t\t\t\t </tr>\n";
while ($array = mysql_fetch_array($eid)) {
$type_col = '#FFFFFF';
if ($array['type'] == 'ref' or $array['type'] == 'eq_ref' or $array['type'] == 'const') {
$type_col = '#D8FFD4';
} else {
//.........這裏部分代碼省略.........
示例6: query
/**
* Execute a direct database query
*
* @param string Database query
* @param boolean [Optional] Do not convert table prefix
* @return @e resource
*/
public function query($the_query, $bypass = false)
{
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['debug'] or $this->obj['use_debug_log'] and $this->obj['debug_log']) {
IPSDebug::startTimer();
}
//-----------------------------------------
// Stop sub selects? (UNION)
//-----------------------------------------
if (!IPS_DB_ALLOW_SUB_SELECTS) {
# On the spot allowance?
if (!$this->allow_sub_select) {
$_tmp = strtolower($this->_removeAllQuotes($the_query));
if (preg_match("#(?:/\\*|\\*/)#i", $_tmp)) {
$this->throwFatalError("Не разрешается использовать комментарии в SQL запросе.\nДобавьте \\ipsRegistry::DB()->allow_sub_select=1; перед запросом, чтобы разрешить их\n{$the_query}");
return false;
}
if (preg_match("#[^_a-zA-Z]union[^_a-zA-Z]#s", $_tmp)) {
$this->throwFatalError("Использование UNION в запросах запрещено.\nДобавьте \\ipsRegistry::DB()->allow_sub_select=1; перед запросом, чтобы разрешить использование\n{$the_query}");
return false;
} else {
if (preg_match_all("#[^_a-zA-Z](select)[^_a-zA-Z]#s", $_tmp, $matches)) {
if (count($matches) > 1) {
$this->throwFatalError("Вложенные SELECT в запросах запрещены.\nДобавьте \\ipsRegistry::DB()->allow_sub_select=1; перед запросом, чтобы разрешить их\n{$the_query}");
return false;
}
}
}
}
}
//-----------------------------------------
// Run the query
//-----------------------------------------
#I had to switch this around... The query goes first, connection id second. Otherwise it just breaks - KF
#$this->query_id = mysql_query($this->connection_id, $the_query );
$this->query_id = mysql_query($the_query, $this->connection_id);
//-----------------------------------------
// Reset array...
//-----------------------------------------
$this->resetDataTypes();
$this->allow_sub_select = false;
if (!$this->query_id) {
$this->throwFatalError("mySQL query error: {$the_query}");
}
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log'] or $this->obj['use_slow_log'] and $this->obj['slow_log']) {
$endtime = IPSDebug::endTimer();
$_data = '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysql_query("EXPLAIN {$the_query}", $this->connection_id);
$_bad = false;
while ($array = mysql_fetch_array($eid)) {
$array['extra'] = isset($array['extra']) ? $array['extra'] : '';
$_data .= "\n+------------------------------------------------------------------------------+";
$_data .= "\n|Table: " . $array['table'];
$_data .= "\n|Type: " . $array['type'];
$_data .= "\n|Possible Keys: " . $array['possible_keys'];
$_data .= "\n|Key: " . $array['key'];
$_data .= "\n|Key Len: " . $array['key_len'];
$_data .= "\n|Ref: " . $array['ref'];
$_data .= "\n|Rows: " . $array['rows'];
$_data .= "\n|Extra: " . $array['Extra'];
//$_data .= "\n+------------------------------------------------------------------------------+";
if ($this->obj['use_bad_log'] and $this->obj['bad_log'] and (stristr($array['Extra'], 'filesort') or stristr($array['Extra'], 'temporary'))) {
$this->writeDebugLog($the_query, $_data, $endtime, $this->obj['bad_log'], TRUE);
}
if ($this->obj['use_slow_log'] and $this->obj['slow_log'] and $endtime >= $this->obj['use_slow_log']) {
$this->writeDebugLog($the_query, $_data, $endtime, $this->obj['slow_log'], TRUE);
}
}
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$this->writeDebugLog($the_query, $_data, $endtime);
}
} else {
if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
$this->writeDebugLog($the_query, $_data, $endtime);
}
}
}
//-----------------------------------------
// Debugging?
//-----------------------------------------
if ($this->obj['debug']) {
$endtime = IPSDebug::endTimer();
$shutdown = $this->is_shutdown ? 'SHUTDOWN QUERY: ' : '';
if (preg_match("/^(?:\\()?select/i", $the_query)) {
$eid = mysql_query("EXPLAIN {$the_query}", $this->connection_id);
$this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>\n\t\t\t\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t\t\t\t \t <td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>{$shutdown}Select Query</b></td>\n\t\t\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t\t\t\t <td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>{$the_query}</td>\n\t\t\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t\t\t\t <tr bgcolor='#FFC5Cb'>\n\t\t\t\t\t\t\t\t\t\t\t <td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>\n\t\t\t\t\t\t\t\t\t\t\t <td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>\n\t\t\t\t\t\t\t\t\t\t\t <td><b>rows</b></td><td><b>Extra</b></td>\n\t\t\t\t\t\t\t\t\t\t </tr>\n";
while ($array = mysql_fetch_array($eid)) {
//.........這裏部分代碼省略.........
示例7: fetchOutput
/**
* Fetches the output
*
* @access public
* @param string Output gathered
* @param string Title of the document
* @param array Navigation gathered
* @param array Array of document head items
* @param array Array of JS loader items
* @param array Array of extra data
* @return string Output to be printed to the client
*/
public function fetchOutput($output, $title, $navigation, $documentHeadItems, $jsLoaderItems, $extraData = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$system_vars_cache = $this->caches['systemvars'];
$showPMBox = '';
//-----------------------------------------
// NORMAL
//-----------------------------------------
if ($this->_outputType == 'normal') {
//-----------------------------------------
// Grab output
//-----------------------------------------
$finalOutput = $this->output->getTemplate('global')->globalTemplate($output, $documentHeadItems, $this->_css, $jsLoaderItems, array('title' => $title, 'applications' => $this->core_fetchApplicationData(), 'page' => $this->_current_page_title), array('navigation' => $navigation, 'pmData' => $pmData, 'showReportBox' => $memberCache['report_last_updated'] < $reportsCache['last_updated'] && $memberCache['report_num'] > 0 ? 1 : 0), array('time' => $this->registry->getClass('class_localization')->getDate(time(), 'SHORT', 1), 'lang_chooser' => $this->html_buildLanguageDropDown(), 'skin_chooser' => $this->html_fetchSetsDropDown(), 'stats' => $this->html_showDebugInfo(), 'copyright' => $this->html_fetchCopyright()), array('ex_time' => sprintf("%.4f", IPSDebug::endTimer()), 'gzip_status' => $this->settings['disable_gzip'] == 1 ? $this->lang->words['gzip_off'] : $this->lang->words['gzip_on'], 'server_load' => ipsRegistry::$server_load, 'queries' => $this->DB->getQueryCount()));
} else {
if ($this->_outputType == 'redirect') {
# SEO?
if ($extraData['seoTitle']) {
$extraData['url'] = $this->output->buildSEOUrl($extraData['url'], 'none', $extraData['seoTitle']);
$extraData['full'] = 1;
}
$finalOutput = $this->output->getTemplate('global')->redirectTemplate($documentHeadItems, $this->_css, $jsLoaderItems, $extraData['text'], $extraData['url'], $extraData['full']);
} else {
if ($this->_outputType == 'popup') {
$finalOutput = $this->output->getTemplate('global')->displayPopUpWindow($documentHeadItems, $this->_css, $jsLoaderItems, $title, $output);
}
}
}
//-----------------------------------------
// Return
//-----------------------------------------
return $this->parseIPSTags($finalOutput);
}