1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 01:36:57 +02:00

Subforums handling part 2, it almost works. Also added: the "Explain" link at the bottom page, can be removed easily before official release if necessary.

git-svn-id: file:///svn/phpbb/trunk@2913 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud
2002-10-03 02:43:41 +00:00
parent 1666e7d3e7
commit 268d936f46
12 changed files with 367 additions and 250 deletions

View File

@@ -583,6 +583,29 @@ function on_page($num_items, $per_page, $start)
return sprintf($lang['Page_of'], floor( $start / $per_page ) + 1, max(ceil( $num_items / $per_page ), 1) );
}
function format_subforums_list($subforums)
{
if (empty($subforums))
{
return '';
}
global $phpEx, $SID;
foreach ($subforums as $row)
{
$alist[$row['forum_id']] = $row['forum_name'];
}
asort($alist);
$links = array();
foreach ($alist as $forum_id => $forum_name)
{
$links[] = '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">' . htmlspecialchars($forum_name) . '</a>';
}
return implode(', ', $links);
}
//
// Obtain list of naughty words and build preg style replacement arrays for use by the
// calling script, note that the vars are passed as references this just makes it easier

View File

@@ -1,6 +1,6 @@
<?php
/***************************************************************************
* functions_post.php
* functions_posting.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
@@ -19,11 +19,6 @@
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
$html_entities_match = array('#&#', '#<#', '#>#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;');

View File

@@ -19,21 +19,28 @@
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
//
// Close our DB connection.
//
$db->sql_close();
//
// Output page creation time
//
if ( defined('DEBUG') )
if (defined('DEBUG'))
{
$mtime = microtime();
$mtime = explode(' ', $mtime);
$totaltime = ( $mtime[1] + $mtime[0] ) - $starttime;
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
$debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . ( ( $session->load ) ? $session->load : 'N/A') . ' ]', $totaltime);
if (!empty($_REQUEST['explain']))
{
echo $db->sql_report;
echo "<pre><b>Page generated in $totaltime seconds with " . $db->num_queries . " queries,\nspending " . $db->sql_time . ' doing MySQL queries and ' . ($totaltime - $db->sql_time) . ' doing PHP things.</b></pre>';
exit;
}
$debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . ( ( $session->load ) ? $session->load : 'N/A') . ' | <a href="' . $_SERVER['REQUEST_URI'] . '&explain=1">Explain</a> ]', $totaltime);
}
$template->assign_vars(array(
@@ -44,11 +51,5 @@ $template->assign_vars(array(
$template->display('body');
//
// Close our DB connection.
//
$db->sql_close();
exit;
?>

View File

@@ -171,9 +171,15 @@ class Template {
*/
function display($handle)
{
if (!empty($_REQUEST['explain']))
{
global $db;
echo $this->sql_report();
return TRUE;
}
$_str = '';
if ( !($this->compile_load($_str, $handle, true)) )
if (!$this->compile_load($_str, $handle, true))
{
if ( !$this->loadfile($handle) )
{