当前位置: 首页>>代码示例>>PHP>>正文


PHP exit_handler函数代码示例

本文整理汇总了PHP中exit_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP exit_handler函数的具体用法?PHP exit_handler怎么用?PHP exit_handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exit_handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: phpbb_end_update

function phpbb_end_update($cache, $config)
{
    $cache->purge();
    $config->increment('assets_version', 1);
    ?>
								</p>
							</div>
						</div>
					<span class="corners-bottom"><span></span></span>
				</div>
			</div>
		</div>

		<div id="page-footer">
			<div class="copyright">
				Powered by <a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Limited
			</div>
		</div>
	</div>
</body>
</html>

<?php 
    garbage_collection();
    exit_handler();
}
开发者ID:kilianr,项目名称:phpbb,代码行数:26,代码来源:database_update.php

示例2: main

    function main($id, $mode)
    {
        global $db, $user, $phpbb_root_path, $config, $phpEx;
        // Do we have an id? No, then just exit
        $confirm_id = request_var('id', '');
        $type = request_var('type', 0);
        if (!$confirm_id || !$type) {
            exit;
        }
        // Try and grab code for this id and session
        $sql = 'SELECT code, seed
			FROM ' . CONFIRM_TABLE . "\n\t\t\tWHERE session_id = '" . $db->sql_escape($user->session_id) . "'\n\t\t\t\tAND confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\tAND confirm_type = {$type}";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        // If we have a row then grab data else create a new id
        if (!$row) {
            exit;
        }
        if ($config['captcha_gd']) {
            include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
        } else {
            include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
        }
        $captcha = new captcha();
        $captcha->execute($row['code'], $row['seed']);
        garbage_collection();
        exit_handler();
    }
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:29,代码来源:ucp_confirm.php

示例3: adm_page_footer

/**
* Page footer for acp pages
*/
function adm_page_footer($copyright_html = true)
{
    global $db, $config, $template, $user, $auth, $cache;
    global $starttime, $phpbb_admin_path;
    // Output page creation time
    if (defined('DEBUG')) {
        $mtime = explode(' ', microtime());
        $totaltime = $mtime[0] + $mtime[1] - $starttime;
        // Let's remove $auth->acl_get('a_') until I finish coding permissions properly... and also add/remove 'a_' when users are added/removed from administrators in ACP
        //$is_admin = (($user->data['user_level'] == ADMIN) || $auth->acl_get('a_')) ? true : false;
        $is_admin = $user->data['user_level'] == ADMIN ? true : false;
        if (!empty($_REQUEST['explain']) && $is_admin && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) {
            $db->sql_report('display');
        }
        $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ($config['gzip_compress'] ? 'On' : 'Off') . ($user->load ? ' | Load : ' . $user->load : ''), $totaltime);
        if ($is_admin && defined('DEBUG_EXTRA')) {
            if (function_exists('memory_get_usage')) {
                if ($memory_usage = memory_get_usage()) {
                    global $base_memory_usage;
                    $memory_usage -= $base_memory_usage;
                    $memory_usage = get_formatted_filesize($memory_usage);
                    $debug_output .= ' | Memory Usage: ' . $memory_usage;
                }
            }
            $debug_output .= ' | <a href="' . build_url() . '&amp;explain=1">Explain</a>';
        }
    }
    $template->assign_vars(array('DEBUG_OUTPUT' => defined('DEBUG') ? $debug_output : '', 'TRANSLATION_INFO' => !empty($user->lang['TRANSLATION_INFO']) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, 'VERSION' => $config['version']));
    $template->display('body');
    garbage_collection();
    exit_handler();
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:35,代码来源:functions_admin_phpbb3.php

示例4: main

 function main($id, $mode)
 {
     global $db, $user, $phpbb_root_path, $config, $phpEx, $phpbb_container;
     $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
     $captcha->init(request_var('type', 0));
     $captcha->execute();
     garbage_collection();
     exit_handler();
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:9,代码来源:ucp_confirm.php

示例5: main

 function main($id, $mode)
 {
     global $config, $phpbb_container, $request;
     $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
     $captcha->init($request->variable('type', 0));
     $captcha->execute();
     garbage_collection();
     exit_handler();
 }
开发者ID:bruninoit,项目名称:phpbb,代码行数:9,代码来源:ucp_confirm.php

示例6: main

 function main($id, $mode)
 {
     global $db, $user, $phpbb_root_path, $config, $phpEx;
     include $phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx;
     $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
     $captcha->init(request_var('type', 0));
     $captcha->execute();
     garbage_collection();
     exit_handler();
 }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:10,代码来源:ucp_confirm.php

示例7: output_ajax_post_preview

 /**
  * Alter preview output for ajax request
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function output_ajax_post_preview($event)
 {
     if ($this->request->is_ajax() && $event['preview']) {
         if (empty($event['message_parser']->message)) {
             exit_handler();
         } else {
             if (sizeof($event['error'])) {
                 // seems to be the best HTTP code
                 header('HTTP/1.1 412 Precondition Failed');
                 echo implode('<br />', $event['error']);
                 exit_handler();
             } else {
                 $this->template->assign_vars($event['page_data']);
                 // we can't use helper's render method, because it refreshes the page
                 page_header('');
                 $this->template->set_filenames(array('body' => '@senky_ajaxbase/ajax_posting_preview.html'));
                 page_footer();
             }
         }
     }
 }
开发者ID:phpbb-store,项目名称:OfficeForum,代码行数:28,代码来源:listener.php

示例8: disabled_board

 public function disabled_board($event)
 {
     $style_id = !$this->config['override_user_style'] ? $this->user->data['user_style'] : $this->config['default_style'];
     $sql = 'SELECT style_id FROM ' . STYLES_TABLE . ' WHERE style_copyright LIKE "© SiteSplat.com%"';
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result);
     $in_sitesplat = in_array($style_id, $row);
     $this->template->assign_vars(array('PM_NEW_COUNT_BADGE' => $this->user->lang('PM_NEW_MSG_BUBBLE', (int) $this->user->data['user_new_privmsg']), 'PM_NEW_COUNT' => $this->user->lang('PM_NEW_MSG', (int) $this->user->data['user_new_privmsg']), 'PM_UNREAD_COUNT' => $this->user->lang('PM_UNREAD_MSG', (int) $this->user->data['user_unread_privmsg'])));
     if ($this->config['board_disable'] && !defined('IN_LOGIN') && $in_sitesplat && !$this->auth->acl_get('a_')) {
         global $phpbb_path_helper, $phpbb_root_path;
         // Determine board url - we may need it later
         $board_url = generate_board_url() . '/';
         // This path is sent with the base template paths in the assign_vars()
         // call below. We need to correct it in case we are accessing from a
         // controller because the web paths will be incorrect otherwise.
         $phpbb_path_helper = $this->phpbb_container->get('path_helper');
         $corrected_path = $phpbb_path_helper->get_web_root_path();
         $web_path = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH ? $board_url : $corrected_path;
         // Send a proper content-language to the output
         $user_lang = $this->user->lang['USER_LANG'];
         if (strpos($user_lang, '-x-') !== false) {
             $user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
         }
         $file = $phpbb_root_path . 'ext/sitesplat/BBCore/styles/all/template/offline_board_body.html';
         $fp = fopen($file, 'r');
         $content = fread($fp, filesize($file));
         fclose($fp);
         $match = array('#\\{S_CONTENT_DIRECTION\\}#', '#\\{S_USER_LANG\\}#', '#\\{S_CONTENT_ENCODING\\}#', '#\\{SITENAME\\}#', '#\\{PAGE_TITLE\\}#', '#\\{T_STYLESHEET_LINK\\}#', '#\\{T_THEME_PATH\\}#', '#\\{SCRIPT_NAME\\}#', '#\\{L_BOARD_DISABLED\\}#', '#\\{ACP_DISABLE_MESSAGE\\}#', '#\\{L_LOGIN_LOGOUT\\}#', '#\\{U_LOGIN_LOGOUT\\}#');
         $replace = array($this->user->lang['DIRECTION'], $user_lang, 'UTF-8', $this->config['sitename'], 'Website offline', "{$web_path}styles/" . rawurlencode($this->user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $this->config['assets_version'], "{$web_path}styles/" . rawurlencode($this->user->style['style_path']) . '/theme', str_replace('.' . 'php', '', $this->user->page['page_name']), 'board disabled', $this->config['board_disable_msg'], $this->user->lang['LOGIN'], append_sid("{$phpbb_root_path}ucp.php", 'mode=login'));
         $content = preg_replace($match, $replace, $content);
         $response = new Response('Content', 200, array('content-type' => 'text/html'));
         $response->setContent($content);
         $response->send();
         garbage_collection();
         exit_handler();
     }
 }
开发者ID:rinodung,项目名称:phpbb-forum,代码行数:37,代码来源:listener.php

示例9: page_footer

/**
* Generate page footer
*
* @param bool $run_cron Whether or not to run the cron
* @param bool $display_template Whether or not to display the template
* @param bool $exit_handler Whether or not to run the exit_handler()
*/
function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
{
    global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx;
    global $request, $phpbb_dispatcher, $phpbb_admin_path;
    // A listener can set this variable to `true` when it overrides this function
    $page_footer_override = false;
    /**
     * Execute code and/or overwrite page_footer()
     *
     * @event core.page_footer
     * @var	bool	run_cron			Shall we run cron tasks
     * @var	bool	page_footer_override	Shall we return instead of running
     *										the rest of page_footer()
     * @since 3.1.0-a1
     */
    $vars = array('run_cron', 'page_footer_override');
    extract($phpbb_dispatcher->trigger_event('core.page_footer', compact($vars)));
    if ($page_footer_override) {
        return;
    }
    phpbb_check_and_display_sql_report($request, $auth, $db);
    $template->assign_vars(array('DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), 'TRANSLATION_INFO' => !empty($user->lang['TRANSLATION_INFO']) ? $user->lang['TRANSLATION_INFO'] : '', 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Limited'), 'U_ACP' => $auth->acl_get('a_') && !empty($user->data['is_registered']) ? append_sid("{$phpbb_admin_path}index.{$phpEx}", false, true, $user->session_id) : ''));
    // Call cron-type script
    $call_cron = false;
    if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check')) {
        $call_cron = true;
        $time_now = !empty($user->time_now) && is_int($user->time_now) ? $user->time_now : time();
        // Any old lock present?
        if (!empty($config['cron_lock'])) {
            $cron_time = explode(' ', $config['cron_lock']);
            // If 1 hour lock is present we do not call cron.php
            if ($cron_time[0] + 3600 >= $time_now) {
                $call_cron = false;
            }
        }
    }
    // Call cron job?
    if ($call_cron) {
        global $phpbb_container;
        $cron = $phpbb_container->get('cron.manager');
        $task = $cron->find_one_ready_task();
        if ($task) {
            $url = $task->get_url();
            $template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />');
        } else {
            $cache->put('_cron.lock_check', true, 60);
        }
    }
    /**
     * Execute code and/or modify output before displaying the template.
     *
     * @event core.page_footer_after
     * @var	bool display_template	Whether or not to display the template
     * @var	bool exit_handler		Whether or not to run the exit_handler()
     *
     * @since 3.1.0-RC5
     */
    $vars = array('display_template', 'exit_handler');
    extract($phpbb_dispatcher->trigger_event('core.page_footer_after', compact($vars)));
    if ($display_template) {
        $template->display('body');
    }
    garbage_collection();
    if ($exit_handler) {
        exit_handler();
    }
}
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:74,代码来源:functions.php

示例10: feed_output

/**
* Outputs data as a Feed.
*
* @param int|array $blog_ids The id's of blogs that are going to get outputted,
* @param string $feed_type The type of feed we are outputting
*/
function feed_output($ids, $feed_type)
{
    global $template, $phpbb_root_path, $phpEx, $page, $mode, $limit, $config, $user, $blog_data, $user_id, $blog_id;
    // Feed explanation page
    if ($feed_type == 'explain') {
        $available_feeds = array('RSS 0.91' => blog_url(false, false, false, array_merge($_GET, array('feed' => 'RSS_0.91'))), 'RSS 1.0' => blog_url(false, false, false, array_merge($_GET, array('feed' => 'RSS_1.0'))), 'RSS 2.0' => blog_url(false, false, false, array_merge($_GET, array('feed' => 'RSS_2.0'))), 'ATOM' => blog_url(false, false, false, array_merge($_GET, array('feed' => 'ATOM'))), 'JAVASCRIPT' => array('url' => blog_url(false, false, false, array_merge($_GET, array('feed' => 'JAVASCRIPT'))), 'text' => htmlspecialchars('<script type="text/javascript" src="' . blog_url(false, false, false, array_merge($_GET, array('feed' => 'JAVASCRIPT', 'output' => 'true'))) . '"></script>'), 'demo' => '<script type="text/javascript" src="' . blog_url(false, false, false, array_merge($_GET, array('feed' => 'JAVASCRIPT', 'output' => 'true'))) . '"></script>'));
        blog_plugins::plugin_do_ref('available_feeds', $available_feeds);
        $message = '<strong>' . $user->lang['AVAILABLE_FEEDS'] . '</strong><br /><br />';
        foreach ($available_feeds as $feed_name => $data) {
            if (!is_array($data)) {
                $message .= '<br /><h2><a href="' . $data . '">' . $feed_name . '</a></h2><div><a href="' . $data . '">' . $data . '</a></div><br />';
            } else {
                $message .= '<br /><h2><a href="' . $data['url'] . '">' . $feed_name . '</a></h2><div><dl class="codebox"><dt>' . $user->lang['CODE'] . ': <a href="#" onclick="selectCode(this); return false;">Select all</a></dt><dd><code style="font-size: 12px;">' . $data['text'] . '</code></dd></dl></div><br />';
                if (isset($data['demo'])) {
                    $message .= $data['demo'];
                }
            }
        }
        trigger_error($message);
    }
    $title = $feed_type == 'JAVASCRIPT' ? str_replace("'", "\\'", $template->_tpldata['navlinks'][sizeof($template->_tpldata['navlinks']) - 1]['FORUM_NAME']) : $template->_tpldata['navlinks'][sizeof($template->_tpldata['navlinks']) - 1]['FORUM_NAME'];
    $template->assign_vars(array('FEED' => $feed_type, 'SELF_URL' => blog_url(false, false, false, array('page' => $page, 'mode' => $mode)), 'SELF_FULL_URL' => blog_url(false, false, false, array('page' => $page, 'mode' => $mode, 'feed' => $feed_type, 'limit' => $limit)), 'TITLE' => $config['sitename'] . ' ' . $title . ' ' . $user->lang['FEED'], 'SITE_URL' => generate_board_url(), 'SITE_DESC' => $config['site_desc'], 'SITE_LANG' => $config['default_lang'], 'CURRENT_TIME' => $feed_type == 'ATOM' ? date3339() : date('r'), 'IMG_MIN' => generate_board_url() . '/styles/' . $user->theme['theme_path'] . '/theme/images/blog/min_dark_blue.gif', 'IMG_MAX' => generate_board_url() . '/styles/' . $user->theme['theme_path'] . '/theme/images/blog/max_dark_blue.gif', 'S_OUTPUT' => isset($_GET['output']) ? true : false));
    if ($ids !== false) {
        if (!is_array($ids)) {
            $ids = array(intval($ids));
        }
        // the items section is only used in RSS 1.0
        if ($feed_type == 'RSS_1.0') {
            if (strpos($mode, 'comments') === false) {
                // output the URLS for the items section
                foreach ($ids as $id) {
                    $template->assign_block_vars('items', array('URL' => blog_url(blog_data::$blog[$id]['user_id'], $id)));
                }
            } else {
                // output the URLS for the items section
                foreach ($ids as $id) {
                    $template->assign_block_vars('items', array('URL' => blog_url(blog_data::$reply[$id]['user_id'], $id)));
                }
            }
        }
        if (strpos($mode, 'comments') === false) {
            // Output the main data
            foreach ($ids as $id) {
                $blog_row = $blog_data->handle_blog_data($id, true);
                $row = array('URL' => blog_url(blog_data::$blog[$id]['user_id'], $id), 'USERNAME' => blog_data::$user[blog_data::$blog[$id]['user_id']]['username'], 'MESSAGE' => str_replace("'", '&#039;', $blog_row['MESSAGE']), 'PUB_DATE' => date('r', blog_data::$blog[$id]['blog_time']), 'DATE_3339' => $feed_type == 'ATOM' ? date3339(blog_data::$blog[$id]['blog_time']) : '');
                $template->assign_block_vars('item', array_merge($blog_row, $row));
            }
        } else {
            // Output the main data
            foreach ($ids as $id) {
                $reply_row = $blog_data->handle_reply_data($id, true);
                $row = array('URL' => blog_url(blog_data::$reply[$id]['user_id'], blog_data::$reply[$id]['blog_id'], $id), 'USERNAME' => blog_data::$user[blog_data::$reply[$id]['user_id']]['username'], 'MESSAGE' => str_replace("'", '&#039;', $reply_row['MESSAGE']), 'PUB_DATE' => date('r', blog_data::$reply[$id]['reply_time']), 'DATE_3339' => $feed_type == 'ATOM' ? date3339(blog_data::$reply[$id]['reply_time']) : '');
                $template->assign_block_vars('item', array_merge($reply_row, $row));
            }
        }
        blog_plugins::plugin_do_arg('function_feed_output', compact('ids', 'feed_type', 'mode'));
    }
    // Output time
    if ($feed_type == 'JAVASCRIPT') {
        header('Content-type: text/html; charset=UTF-8');
    } else {
        header('Content-type: application/xml; charset=UTF-8');
    }
    header('Cache-Control: private, no-cache="set-cookie"');
    header('Expires: 0');
    header('Pragma: no-cache');
    $template->set_template();
    $template->set_filenames(array('body' => 'blog/blog_feed.xml'));
    $template->display('body');
    garbage_collection();
    exit_handler();
}
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:78,代码来源:functions_view.php

示例11: _download_result

 /**
  * Download the MySQL Upgrader script
  * @access private
  * @return void
  */
 function _download_result()
 {
     global $cache;
     // Read from the cache
     $result = $cache->get('_stk_mysql_upgrader_result');
     if ($result === false) {
         return;
     }
     // Write the file
     header('Content-Type: text/x-delimtext; name="mysql_upgrader.sql"');
     header('Content-disposition: attachment; filename=mysql_upgrader.sql');
     print $result;
     // Exit
     garbage_collection();
     exit_handler();
 }
开发者ID:napus,项目名称:support-toolkit,代码行数:21,代码来源:mysql_upgrader.php

示例12: perform_unauthed_quick_tasks

/**
 * Perform all quick tasks that has to be ran before we authenticate
 *
 * @param	String	$action	The action to perform
 */
function perform_unauthed_quick_tasks($action)
{
    global $template, $user;
    switch ($action) {
        // If the user wants to destroy their STK login cookie
        case 'stklogout':
            setcookie('stk_token', '', time() - 31536000);
            $user->unset_admin();
            meta_refresh(3, append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT));
            trigger_error('STK_LOGOUT_SUCCESS');
            break;
            // Generate the passwd file
        // Generate the passwd file
        case 'genpasswdfile':
            // Create a 25 character alphanumeric password (easier to select with a browser and won't cause confusion like it could if it ends in "." or something).
            $_pass_string = substr(preg_replace(array('#([^a-zA-Z0-9])#', '#0#', '#O#'), array('', 'Z', 'Y'), phpbb_hash(unique_id())), 2, 25);
            // The password is usable for 6 hours from now
            $_pass_exprire = time() + 21600;
            // Print a message and tell the user what to do and where to download this page
            page_header($user->lang['GEN_PASS_FILE'], false);
            $template->assign_vars(array('PASS_GENERATED' => sprintf($user->lang['PASS_GENERATED'], $_pass_string, $user->format_date($_pass_exprire, false, true)), 'PASS_GENERATED_REDIRECT' => sprintf($user->lang['PASS_GENERATED_REDIRECT'], append_sid(STK_ROOT_PATH . 'index.' . PHP_EXT)), 'S_HIDDEN_FIELDS' => build_hidden_fields(array('pass_string' => $_pass_string, 'pass_exp' => $_pass_exprire)), 'U_ACTION' => append_sid(STK_INDEX, array('action' => 'downpasswdfile'))));
            $template->set_filenames(array('body' => 'gen_password.html'));
            page_footer(false);
            break;
            // Download the passwd file
        // Download the passwd file
        case 'downpasswdfile':
            $_pass_string = request_var('pass_string', '', true);
            $_pass_exprire = request_var('pass_exp', 0);
            // Something went wrong, stop execution
            if (!isset($_POST['download_passwd']) || empty($_pass_string) || $_pass_exprire <= 0) {
                trigger_error($user->lang['GEN_PASS_FAILED'], E_USER_ERROR);
            }
            // Create the file and let the user download it
            header('Content-Type: text/x-delimtext; name="passwd.' . PHP_EXT . '"');
            header('Content-disposition: attachment; filename=passwd.' . PHP_EXT);
            print "<?php\n/**\n* Support Toolkit emergency password.\n* The file was generated on: " . $user->format_date($_pass_exprire - 21600, 'd/M/Y H:i.s', true) . " and will expire on: " . $user->format_date($_pass_exprire, 'd/M/Y H:i.s', true) . ".\n*/\n\n// This file can only be from inside the Support Toolkit\nif (!defined('IN_PHPBB') || !defined('STK_VERSION'))\n{\n\texit;\n}\n\n\$stk_passwd\t\t\t\t= '{$_pass_string}';\n\$stk_passwd_expiration\t= {$_pass_exprire};\n";
            exit_handler();
            break;
    }
}
开发者ID:napus,项目名称:support-toolkit,代码行数:46,代码来源:functions.php

示例13: sql_report

    /**
     * Explain queries
     */
    function sql_report($mode, $query = '')
    {
        global $cache, $starttime, $phpbb_root_path, $user;
        if (empty($_REQUEST['explain'])) {
            return false;
        }
        if (!$query && $this->query_hold != '') {
            $query = $this->query_hold;
        }
        switch ($mode) {
            case 'display':
                if (!empty($cache)) {
                    $cache->unload();
                }
                $this->sql_close();
                $mtime = explode(' ', microtime());
                $totaltime = $mtime[0] + $mtime[1] - $starttime;
                echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
					<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
					<head>
						<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
						<meta http-equiv="Content-Style-Type" content="text/css" />
						<meta http-equiv="imagetoolbar" content="no" />
						<title>SQL Report</title>
						<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
					</head>
					<body id="errorpage">
					<div id="wrap">
						<div id="page-header">
							<a href="' . build_url('explain') . '">Return to previous page</a>
						</div>
						<div id="page-body">
							<div id="acp">
							<div class="panel">
								<span class="corners-top"><span></span></span>
								<div id="content">
									<h1>SQL Report</h1>
									<br />
									<p><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries['normal']} queries" . ($this->num_queries['cached'] ? " + {$this->num_queries['cached']} " . ($this->num_queries['cached'] == 1 ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></p>

									<p>Time spent on ' . $this->sql_layer . ' queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></p>

									<br /><br />
									' . $this->sql_report . '
								</div>
								<span class="corners-bottom"><span></span></span>
							</div>
							</div>
						</div>
						<div id="page-footer">
							Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>
						</div>
					</div>
					</body>
					</html>';
                exit_handler();
                break;
            case 'stop':
                $endtime = explode(' ', microtime());
                $endtime = $endtime[0] + $endtime[1];
                $this->sql_report .= '

					<table cellspacing="1">
					<thead>
					<tr>
						<th>Query #' . $this->num_queries['total'] . '</th>
					</tr>
					</thead>
					<tbody>
					<tr>
						<td class="row3"><textarea style="font-family:\'Courier New\',monospace;width:99%" rows="5" cols="10">' . preg_replace('/\\t(AND|OR)(\\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\\s]*[\\n\\r\\t]+[\\n\\r\\s\\t]*/', "\n", $query))) . '</textarea></td>
					</tr>
					</tbody>
					</table>

					' . $this->html_hold . '

					<p style="text-align: center;">
				';
                if ($this->query_result) {
                    if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) {
                        $this->sql_report .= 'Affected rows: <b>' . $this->sql_affectedrows($this->query_result) . '</b> | ';
                    }
                    $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: <b>' . sprintf('%.5f', $endtime - $this->curtime) . 's</b>';
                } else {
                    $error = $this->sql_error();
                    $this->sql_report .= '<b style="color: red">FAILED</b> - ' . $this->sql_layer . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']);
                }
                $this->sql_report .= '</p><br /><br />';
                $this->sql_time += $endtime - $this->curtime;
                break;
            case 'start':
                $this->query_hold = $query;
                $this->html_hold = '';
                $this->_sql_report($mode, $query);
                $this->curtime = explode(' ', microtime());
                $this->curtime = $this->curtime[0] + $this->curtime[1];
//.........这里部分代码省略.........
开发者ID:bryanveloso,项目名称:sayonarane,代码行数:101,代码来源:dbal.php

示例14: render_data_for_page


//.........这里部分代码省略.........
                // will be modified by generate_text_for_storage
                generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_allow_bbcode, $mchat_urls, $mchat_smilies);
                // Not allowed bbcodes
                if (!$mchat_allow_bbcode || $this->config_mchat['bbcode_disallowed']) {
                    if (!$mchat_allow_bbcode) {
                        $bbcode_remove = '#\\[/?[^\\[\\]]+\\]#Usi';
                        $message = preg_replace($bbcode_remove, '', $message);
                    } else {
                        if ($this->config_mchat['bbcode_disallowed']) {
                            if (empty($bbcode_replace)) {
                                $bbcode_replace = array('#\\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\\[\\]]+\\]#Usi', '#\\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\\[\\]]+\\]#Usi');
                            }
                            $message = preg_replace($bbcode_replace, '', $message);
                        }
                    }
                }
                $sql_ary = array('forum_id' => 0, 'post_id' => 0, 'user_id' => $this->user->data['user_id'], 'user_ip' => $this->user->data['session_ip'], 'message' => str_replace('\'', '&rsquo;', $message), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'bbcode_options' => $options, 'message_time' => time());
                $sql = 'INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
                $this->db->sql_query($sql);
                // reset the config settings
                if (isset($old_cfg['min_post_chars'])) {
                    $this->config['min_post_chars'] = $old_cfg['min_post_chars'];
                    unset($old_cfg['min_post_chars']);
                }
                if (isset($old_cfg['max_post_smilies'])) {
                    $this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
                    unset($old_cfg['max_post_smilies']);
                }
                // Stop run code!
                if ($this->request->is_ajax()) {
                    // Return for: \Symfony\Component\HttpFoundation\JsonResponse
                    return array('json' => true, 'success' => true);
                } else {
                    exit_handler();
                }
                break;
                // Edit function...
            // Edit function...
            case 'edit':
                $message_id = $this->request->variable('message_id', 0);
                // If mChat disabled and not edit
                if (!$this->config['mchat_enable'] || !$message_id) {
                    // Forbidden (for jQ AJAX request)
                    throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
                }
                // check for the correct user
                $sql = 'SELECT *
					FROM ' . $this->mchat_table . '
					WHERE message_id = ' . (int) $message_id;
                $result = $this->db->sql_query($sql);
                $row = $this->db->sql_fetchrow($result);
                $this->db->sql_freeresult($result);
                // edit and delete auths
                $mchat_edit = $this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
                $mchat_del = $this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
                // If mChat disabled and not edit
                if (!$mchat_edit) {
                    // Forbidden (for jQ AJAX request)
                    throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
                }
                // Reguest...
                $message = $this->request->variable('message', '', true);
                // must have something other than bbcode in the message
                if (empty($mchatregex)) {
                    //let's strip all the bbcode
                    $mchatregex = '#\\[/?[^\\[\\]]+\\]#mi';
开发者ID:ezpz-cz,项目名称:web-plugins,代码行数:67,代码来源:render_helper.php

示例15: upload_popup

/**
* Show upload popup (progress bar)
*/
function upload_popup($forum_style = 0)
{
    global $template, $user;
    $forum_style ? $user->setup('posting', $forum_style) : $user->setup('posting');
    page_header($user->lang['PROGRESS_BAR'], false);
    $template->set_filenames(array('popup' => 'posting_progress_bar.html'));
    $template->assign_vars(array('PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])));
    $template->display('popup');
    garbage_collection();
    exit_handler();
}
开发者ID:PetsFundation,项目名称:Pets,代码行数:14,代码来源:posting.php


注:本文中的exit_handler函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。