Les archives de FluxBB.fr
Vous n'êtes pas identifié(e).
Bonsoir, alors voilà, je suis en local avec mon flux, et lorsque j'essaye d'installer la Mod, j'ai des erreurs sur les haut de pages de:
/search.php?
/viewtopic.php?id=1
/post.php?tid=1
Sur le coup j'ai pensé à une mauvaise installation mais, je l'ai réinstallé 5 fois et même résultats à chacune des tentatives.
Ensuite j'ai pensé à une incompatibilité avec mon Host, mais non, car en passant en local les erreurs persistent.
Ma question est , pourriez-vous analyser les fichiers concernés et me dire ce qu'il ne va pas ?
Je tiens à préciser que je n'ai rien installé d'autre sur le fluxbb.
search.php
<?php
/**
* Copyright (C) 2008-2010 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
// The contents of this file are very much inspired by the file search.php
// from the phpBB Group forum software phpBB2 (http://www.phpbb.com)
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
// Load the search.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/search.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view']);
else if ($pun_user['g_search'] == '0')
message($lang_search['No search permission']);
require PUN_ROOT.'include/search_idx.php';
// Figure out what to do :-)
if (isset($_GET['action']) || isset($_GET['search_id']))
{
$action = (isset($_GET['action'])) ? $_GET['action'] : null;
$forum = (isset($_GET['forum'])) ? intval($_GET['forum']) : -1;
$sort_dir = (isset($_GET['sort_dir']) && $_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC';
// If a search_id was supplied
if (isset($_GET['search_id']))
{
$search_id = intval($_GET['search_id']);
if ($search_id < 1)
message($lang_common['Bad request']);
}
// If it's a regular search (keywords and/or author)
else if ($action == 'search')
{
$keywords = (isset($_GET['keywords'])) ? utf8_strtolower(pun_trim($_GET['keywords'])) : null;
$author = (isset($_GET['author'])) ? utf8_strtolower(pun_trim($_GET['author'])) : null;
if (preg_match('#^[\*%]+$#', $keywords) || (pun_strlen(str_replace(array('*', '%'), '', $keywords)) < PUN_SEARCH_MIN_WORD && !is_cjk($keywords)))
$keywords = '';
if (preg_match('#^[\*%]+$#', $author) || pun_strlen(str_replace(array('*', '%'), '', $author)) < 2)
$author = '';
if (!$keywords && !$author)
message($lang_search['No terms']);
if ($author)
$author = str_replace('*', '%', $author);
$show_as = (isset($_GET['show_as'])) ? $_GET['show_as'] : 'posts';
$sort_by = (isset($_GET['sort_by'])) ? intval($_GET['sort_by']) : null;
$search_in = (!isset($_GET['search_in']) || $_GET['search_in'] == 'all') ? 0 : (($_GET['search_in'] == 'message') ? 1 : -1);
}
// If it's a user search (by ID)
else if ($action == 'show_user')
{
$user_id = (isset($_GET['user_id'])) ? intval($_GET['user_id']) : 0;
if ($user_id < 2)
message($lang_common['Bad request']);
}
else
{
if ($action != 'show_new' && $action != 'show_24h' && $action != 'show_unanswered' && $action != 'show_subscriptions')
message($lang_common['Bad request']);
}
// If a valid search_id was supplied we attempt to fetch the search results from the db
if (isset($search_id))
{
$ident = ($pun_user['is_guest']) ? get_remote_address() : $pun_user['username'];
$result = $db->query('SELECT search_data FROM '.$db->prefix.'search_cache WHERE id='.$search_id.' AND ident=\''.$db->escape($ident).'\'') or error('Unable to fetch search results', __FILE__, __LINE__, $db->error());
if ($row = $db->fetch_assoc($result))
{
$temp = unserialize($row['search_data']);
$search_ids = unserialize($temp['search_ids']);
$num_hits = $temp['num_hits'];
$sort_by = $temp['sort_by'];
$sort_dir = $temp['sort_dir'];
$show_as = $temp['show_as'];
unset($temp);
}
else
message($lang_search['No hits']);
}
else
{
$keyword_results = $author_results = array();
// Search a specific forum?
$forum_sql = ($forum != -1 || ($forum == -1 && $pun_config['o_search_all_forums'] == '0' && !$pun_user['is_admmod'])) ? ' AND t.forum_id = '.$forum : '';
if (!empty($author) || !empty($keywords))
{
// Flood protection
if ($pun_user['last_search'] && (time() - $pun_user['last_search']) < $pun_user['g_search_flood'] && (time() - $pun_user['last_search']) >= 0)
message(sprintf($lang_search['Search flood'], $pun_user['g_search_flood']));
if (!$pun_user['is_guest'])
$db->query('UPDATE '.$db->prefix.'users SET last_search='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
else
$db->query('UPDATE '.$db->prefix.'online SET last_search='.time().' WHERE ident=\''.$db->escape(get_remote_address()).'\'' ) or error('Unable to update user', __FILE__, __LINE__, $db->error());
switch ($sort_by)
{
case 1:
$sort_by_sql = ($show_as == 'topics') ? 't.poster' : 'p.poster';
$sort_type = SORT_STRING;
break;
case 2:
$sort_by_sql = 't.subject';
$sort_type = SORT_STRING;
break;
case 3:
$sort_by_sql = 't.forum_id';
$sort_type = SORT_NUMERIC;
break;
case 4:
$sort_by_sql = 't.last_post';
$sort_type = SORT_NUMERIC;
break;
default:
$sort_by_sql = ($show_as == 'topics') ? 't.last_post' : 'p.posted';
$sort_type = SORT_NUMERIC;
break;
}
// If it's a search for keywords
if ($keywords)
{
// split the keywords into words
$keywords_array = split_words($keywords, false);
if (empty($keywords_array))
message($lang_search['No hits']);
// Should we search in message body or topic subject specifically?
$search_in_cond = ($search_in) ? (($search_in > 0) ? ' AND m.subject_match = 0' : ' AND m.subject_match = 1') : '';
$word_count = 0;
$match_type = 'and';
$sort_data = array();
foreach ($keywords_array as $cur_word)
{
switch ($cur_word)
{
case 'and':
case 'or':
case 'not':
$match_type = $cur_word;
break;
default:
{
if (is_cjk($cur_word))
{
$where_cond = str_replace('*', '%', $cur_word);
$where_cond = ($search_in ? (($search_in > 0) ? 'p.message LIKE \'%'.$db->escape($where_cond).'%\'' : 't.subject LIKE \'%'.$db->escape($where_cond).'%\'') : 'p.message LIKE \'%'.$db->escape($where_cond).'%\' OR t.subject LIKE \'%'.$db->escape($where_cond).'%\'');
$result = $db->query('SELECT p.id AS post_id, p.topic_id, '.$sort_by_sql.' AS sort_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE ('.$where_cond.') AND (fp.read_forum IS NULL OR fp.read_forum=1)'.$forum_sql, true) or error('Unable to search for posts', __FILE__, __LINE__, $db->error());
}
else
$result = $db->query('SELECT m.post_id, p.topic_id, '.$sort_by_sql.' AS sort_by FROM '.$db->prefix.'search_words AS w INNER JOIN '.$db->prefix.'search_matches AS m ON m.word_id = w.id INNER JOIN '.$db->prefix.'posts AS p ON p.id=m.post_id INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE w.word LIKE \''.$db->escape(str_replace('*', '%', $cur_word)).'\''.$search_in_cond.' AND (fp.read_forum IS NULL OR fp.read_forum=1)'.$forum_sql, true) or error('Unable to search for posts', __FILE__, __LINE__, $db->error());
$row = array();
while ($temp = $db->fetch_assoc($result))
{
$row[$temp['post_id']] = $temp['topic_id'];
if (!$word_count)
{
$keyword_results[$temp['post_id']] = $temp['topic_id'];
$sort_data[$temp['post_id']] = $temp['sort_by'];
}
else if ($match_type == 'or')
{
$keyword_results[$temp['post_id']] = $temp['topic_id'];
$sort_data[$temp['post_id']] = $temp['sort_by'];
}
else if ($match_type == 'not')
{
unset($keyword_results[$temp['post_id']]);
unset($sort_data[$temp['post_id']]);
}
}
if ($match_type == 'and' && $word_count)
{
foreach ($keyword_results as $post_id => $topic_id)
{
if (!isset($row[$post_id]))
{
unset($keyword_results[$post_id]);
unset($sort_data[$post_id]);
}
}
}
++$word_count;
$db->free_result($result);
break;
}
}
}
// Sort the results - annoyingly array_multisort re-indexes arrays with numeric keys, so we need to split the keys out into a seperate array then combine them again after
$post_ids = array_keys($keyword_results);
$topic_ids = array_values($keyword_results);
array_multisort(array_values($sort_data), $sort_dir == 'DESC' ? SORT_DESC : SORT_ASC, $sort_type, $post_ids, $topic_ids);
// combine the arrays back into a key=>value array (array_combine is PHP5 only unfortunately)
$num_results = count($keyword_results);
$keyword_results = array();
for ($i = 0;$i < $num_results;$i++)
$keyword_results[$post_ids[$i]] = $topic_ids[$i];
unset($sort_data, $post_ids, $topic_ids);
}
// If it's a search for author name (and that author name isn't Guest)
if ($author && $author != 'guest' && $author != utf8_strtolower($lang_common['Guest']))
{
switch ($db_type)
{
case 'pgsql':
$result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE username ILIKE \''.$db->escape($author).'\'') or error('Unable to fetch users', __FILE__, __LINE__, $db->error());
break;
default:
$result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE username LIKE \''.$db->escape($author).'\'') or error('Unable to fetch users', __FILE__, __LINE__, $db->error());
break;
}
if ($db->num_rows($result))
{
$user_ids = array();
while ($row = $db->fetch_row($result))
$user_ids[] = $row[0];
$result = $db->query('SELECT p.id AS post_id, p.topic_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.poster_id IN('.implode(',', $user_ids).')'.$forum_sql.' ORDER BY '.$sort_by_sql.' '.$sort_dir) or error('Unable to fetch matched posts list', __FILE__, __LINE__, $db->error());
while ($temp = $db->fetch_assoc($result))
$author_results[$temp['post_id']] = $temp['topic_id'];
$db->free_result($result);
}
}
// If we searched for both keywords and author name we want the intersection between the results
if ($author && $keywords)
$search_ids = array_intersect_assoc($keyword_results, $author_results);
else if ($keywords)
$search_ids = $keyword_results;
else
$search_ids = $author_results;
unset($keyword_results, $author_results);
if ($show_as == 'topics')
$search_ids = array_values($search_ids);
else
$search_ids = array_keys($search_ids);
$search_ids = array_unique($search_ids);
$num_hits = count($search_ids);
if (!$num_hits)
message($lang_search['No hits']);
}
else if ($action == 'show_new' || $action == 'show_24h' || $action == 'show_user' || $action == 'show_subscriptions' || $action == 'show_unanswered')
{
// If it's a search for new posts
if ($action == 'show_new')
{
if ($pun_user['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL'.(isset($_GET['fid']) ? ' AND t.forum_id='.intval($_GET['fid']) : '').' ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No new posts']);
}
// If it's a search for todays posts
else if ($action == 'show_24h')
{
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 86400).' AND t.moved_to IS NULL ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No recent posts']);
}
// If it's a search for posts by a specific user ID
else if ($action == 'show_user')
{
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.poster_id='.$user_id.' GROUP BY t.id ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No user posts']);
}
// If it's a search for subscribed topics
else if ($action == 'show_subscriptions')
{
if ($pun_user['is_guest'])
message($lang_common['Bad request']);
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No subscriptions']);
}
// If it's a search for unanswered posts
else
{
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.num_replies=0 AND t.moved_to IS NULL ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No unanswered']);
}
// We want to sort things after last post
$sort_by = 4;
$sort_dir = 'DESC';
$search_ids = array();
while ($row = $db->fetch_row($result))
$search_ids[] = $row[0];
$db->free_result($result);
$show_as = 'topics';
}
else
message($lang_common['Bad request']);
// Prune "old" search results
$old_searches = array();
$result = $db->query('SELECT ident FROM '.$db->prefix.'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($row = $db->fetch_row($result))
$old_searches[] = '\''.$db->escape($row[0]).'\'';
$db->query('DELETE FROM '.$db->prefix.'search_cache WHERE ident NOT IN('.implode(',', $old_searches).')') or error('Unable to delete search results', __FILE__, __LINE__, $db->error());
}
// Fill an array with our results and search properties
$temp = serialize(array(
'search_ids' => serialize($search_ids),
'num_hits' => $num_hits,
'sort_by' => $sort_by,
'sort_dir' => $sort_dir,
'show_as' => $show_as,
));
$search_id = mt_rand(1, 2147483647);
$ident = ($pun_user['is_guest']) ? get_remote_address() : $pun_user['username'];
$db->query('INSERT INTO '.$db->prefix.'search_cache (id, ident, search_data) VALUES('.$search_id.', \''.$db->escape($ident).'\', \''.$db->escape($temp).'\')') or error('Unable to insert search results', __FILE__, __LINE__, $db->error());
if ($action != 'show_new' && $action != 'show_24h')
{
$db->end_transaction();
$db->close();
// Redirect the user to the cached result page
header('Location: search.php?search_id='.$search_id);
exit;
}
}
// Fetch results to display
if (!empty($search_ids))
{
switch ($sort_by)
{
case 1:
$sort_by_sql = ($show_as == 'topics') ? 't.poster' : 'p.poster';
break;
case 2:
$sort_by_sql = 't.subject';
break;
case 3:
$sort_by_sql = 't.forum_id';
break;
case 4:
$sort_by_sql = 't.last_post';
break;
default:
$sort_by_sql = ($show_as == 'topics') ? 't.last_post' : 'p.posted';
break;
}
// Determine the topic or post offset (based on $_GET['p'])
$per_page = ($show_as == 'posts') ? $pun_user['disp_posts'] : $pun_user['disp_topics'];
$num_pages = ceil($num_hits / $per_page);
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']);
$start_from = $per_page * ($p - 1);
// Generate paging links
$paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'search.php?search_id='.$search_id);
// throw away the first $start_from of $search_ids, only keep the top $per_page of $search_ids
$search_ids = array_slice($search_ids, $start_from, $per_page);
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_search['Search results']);
define('PUN_ACTIVE_PAGE', 'search');
require PUN_ROOT.'header.php';
?>
<div class="linkst">
<div class="inbox">
<p class="pagelink"><?php echo $paging_links ?></p>
<div class="clearer"></div>
</div>
</div>
<?php
if ($show_as == 'topics')
{
$topic_count = 0;
?>
<div id="vf" class="blocktable">
<h2><span><?php echo $lang_search['Search results'] ?></span></h2>
<div class="box">
<div class="inbox">
<table cellspacing="0">
<thead>
<tr>
<th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
<th class="tc2" scope="col"><?php echo $lang_common['Forum'] ?></th>
<th class="tc3" scope="col"><?php echo $lang_common['Replies'] ?></th>
<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
</tr>
</thead>
<tbody>
<?php
}
else if ($show_as == 'posts')
{
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'include/parser.php';
$post_count = 0;
}
// Get topic/forum tracking data
if (!$pun_user['is_guest'])
$tracked_topics = get_tracked_topics();
if ($show_as == 'posts')
$result = $db->query('SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, p.message, p.hide_smilies, t.id AS tid, t.poster, t.subject, t.first_post_id, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id, f.forum_name, g.g_color FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE p.id IN('.implode(',', $search_ids).') ORDER BY '.$sort_by_sql.' '.$sort_dir) or error('Unable to fetch search results', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.sticky, t.forum_id, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.id IN('.implode(',', $search_ids).') ORDER BY '.$sort_by_sql.' '.$sort_dir) or error('Unable to fetch search results', __FILE__, __LINE__, $db->error());
while ($cur_search = $db->fetch_assoc($result))
{
$forum = '<a href="viewforum.php?id='.$cur_search['forum_id'].'">'.pun_htmlspecialchars($cur_search['forum_name']).'</a>';
if ($pun_config['o_censoring'] == '1')
$cur_search['subject'] = censor_words($cur_search['subject']);
if ($show_as == 'posts')
{
++$post_count;
$icon_type = 'icon';
if (!$pun_user['is_guest'] && $cur_search['last_post'] > $pun_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']))
{
$item_status = 'inew';
$icon_type = 'icon icon-new';
$icon_text = $lang_topic['New icon'];
}
else
{
$item_status = '';
$icon_text = '<!-- -->';
}
if ($pun_config['o_censoring'] == '1')
$cur_search['message'] = censor_words($cur_search['message']);
$message = parse_message($cur_search['message'], $cur_search['hide_smilies']);
$pposter = pun_htmlspecialchars($cur_search['pposter']);
if ($cur_search['poster_id'] > 1)
{
$colorspan = (!empty($cur_search['g_color'])) ? '<span style="color:'.$cur_search['g_color'].'; font-weight:bold">' : '';
$colorspan2 = (!empty($cur_search['g_color'])) ? '</span>' : '';
if ($pun_user['g_view_users'] == '1')
$pposter = '<strong><a href="profile.php?id='.$cur_search['poster_id'].'">'.$colorspan.$pposter.$colorspan2.'</a></strong>';
else
$pposter = '<strong>'.$colorspan.$pposter.$colorspan2.'</strong>';
}
?>
<div class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?><?php if ($cur_search['pid'] == $cur_search['first_post_id']) echo ' firstpost' ?><?php if ($post_count == 1) echo ' blockpost1' ?><?php if ($item_status != '') echo ' '.$item_status ?>">
<h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?></span> <span><?php if ($cur_search['pid'] != $cur_search['first_post_id']) echo $lang_topic['Re'].' ' ?><?php echo $forum ?></span> <span>» <a href="viewtopic.php?id=<?php echo $cur_search['tid'] ?>"><?php echo pun_htmlspecialchars($cur_search['subject']) ?></a></span> <span>» <a href="viewtopic.php?pid=<?php echo $cur_search['pid'].'#p'.$cur_search['pid'] ?>"><?php echo format_time($cur_search['pposted']) ?></a></span></span></h2>
<div class="box">
<div class="inbox">
<div class="postbody">
<div class="postleft">
<dl>
<dt><?php echo $pposter ?></dt>
<dd><span><?php echo $lang_topic['Replies'].' '.forum_number_format($cur_search['num_replies']) ?></span></dd>
<dd><div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div></dd>
</dl>
</div>
<div class="postright">
<div class="postmsg">
<?php echo $message."\n" ?>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="inbox">
<div class="postfoot clearb">
<div class="postfootright">
<ul>
<li><span><a href="viewtopic.php?id=<?php echo $cur_search['tid'] ?>"><?php echo $lang_search['Go to topic'] ?></a></span></li>
<li><span><a href="viewtopic.php?pid=<?php echo $cur_search['pid'].'#p'.$cur_search['pid'] ?>"><?php echo $lang_search['Go to post'] ?></a></span></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php
}
else
{
++$topic_count;
$status_text = array();
$item_status = ($topic_count % 2 == 0) ? 'roweven' : 'rowodd';
$icon_type = 'icon';
$subject = '<a href="viewtopic.php?id='.$cur_search['tid'].'">'.pun_htmlspecialchars($cur_search['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_search['poster']).'</span>';
if ($cur_search['sticky'] == '1')
{
$item_status .= ' isticky';
$status_text[] = '<span class="stickytext">'.$lang_forum['Sticky'].'</span>';
}
if ($cur_search['closed'] != '0')
{
$status_text[] = '<span class="closedtext">'.$lang_forum['Closed'].'</span>';
$item_status .= ' iclosed';
}
if (!$pun_user['is_guest'] && $cur_search['last_post'] > $pun_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']))
{
$item_status .= ' inew';
$icon_type = 'icon icon-new';
$subject = '<strong>'.$subject.'</strong>';
$subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_search['tid'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>';
}
else
$subject_new_posts = null;
// Insert the status text before the subject
$subject = implode(' ', $status_text).' '.$subject;
$num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $pun_user['disp_posts']);
if ($num_pages_topic > 1)
$subject_multipage = '<span class="pagestext">[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_search['tid']).' ]</span>';
else
$subject_multipage = null;
// Should we show the "New posts" and/or the multipage links?
if (!empty($subject_new_posts) || !empty($subject_multipage))
{
$subject .= !empty($subject_new_posts) ? ' '.$subject_new_posts : '';
$subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
}
?>
<tr class="<?php echo $item_status ?>">
<td class="tcl">
<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo forum_number_format($topic_count + $start_from) ?></div></div>
<div class="tclcon">
<div>
<?php echo $subject."\n" ?>
</div>
</div>
</td>
<td class="tc2"><?php echo $forum ?></td>
<td class="tc3"><?php echo forum_number_format($cur_search['num_replies']) ?></td>
<td class="tcr"><?php echo '<a href="viewtopic.php?pid='.$cur_search['last_post_id'].'#p'.$cur_search['last_post_id'].'">'.format_time($cur_search['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_search['last_poster']) ?></span></td>
</tr>
<?php
}
}
if ($show_as == 'topics')
echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
?>
<div class="<?php echo ($show_as == 'topics') ? 'linksb' : 'postlinksb'; ?>">
<div class="inbox">
<p class="pagelink"><?php echo $paging_links ?></p>
<div class="clearer"></div>
</div>
</div>
<?php
$footer_style = 'search';
require PUN_ROOT.'footer.php';
}
else
message($lang_search['No hits']);
}
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_search['Search']);
$focus_element = array('search', 'keywords');
define('PUN_ACTIVE_PAGE', 'search');
require PUN_ROOT.'header.php';
?>
<div id="searchform" class="blockform">
<h2><span><?php echo $lang_search['Search'] ?></span></h2>
<div class="box">
<form id="search" method="get" action="search.php">
<div class="inform">
<fieldset>
<legend><?php echo $lang_search['Search criteria legend'] ?></legend>
<div class="infldset">
<input type="hidden" name="action" value="search" />
<label class="conl"><?php echo $lang_search['Keyword search'] ?><br /><input type="text" name="keywords" size="40" maxlength="100" /><br /></label>
<label class="conl"><?php echo $lang_search['Author search'] ?><br /><input id="author" type="text" name="author" size="25" maxlength="25" /><br /></label>
<p class="clearb"><?php echo $lang_search['Search info'] ?></p>
</div>
</fieldset>
</div>
<div class="inform">
<fieldset>
<legend><?php echo $lang_search['Search in legend'] ?></legend>
<div class="infldset">
<label class="conl"><?php echo $lang_search['Forum search']."\n" ?>
<br /><select id="forum" name="forum">
<?php
if ($pun_config['o_search_all_forums'] == '1' || $pun_user['is_admmod'])
echo "\t\t\t\t\t\t\t".'<option value="-1">'.$lang_search['All forums'].'</option>'."\n";
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
$cur_category = 0;
while ($cur_forum = $db->fetch_assoc($result))
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
if ($cur_category)
echo "\t\t\t\t\t\t\t".'</optgroup>'."\n";
echo "\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n";
$cur_category = $cur_forum['cid'];
}
echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</option>'."\n";
}
?>
</optgroup>
</select>
<br /></label>
<label class="conl"><?php echo $lang_search['Search in']."\n" ?>
<br /><select id="search_in" name="search_in">
<option value="all"><?php echo $lang_search['Message and subject'] ?></option>
<option value="message"><?php echo $lang_search['Message only'] ?></option>
<option value="topic"><?php echo $lang_search['Topic only'] ?></option>
</select>
<br /></label>
<p class="clearb"><?php echo $lang_search['Search in info'] ?></p>
</div>
</fieldset>
</div>
<div class="inform">
<fieldset>
<legend><?php echo $lang_search['Search results legend'] ?></legend>
<div class="infldset">
<label class="conl"><?php echo $lang_search['Sort by']."\n" ?>
<br /><select name="sort_by">
<option value="0"><?php echo $lang_search['Sort by post time'] ?></option>
<option value="1"><?php echo $lang_search['Sort by author'] ?></option>
<option value="2"><?php echo $lang_search['Sort by subject'] ?></option>
<option value="3"><?php echo $lang_search['Sort by forum'] ?></option>
</select>
<br /></label>
<label class="conl"><?php echo $lang_search['Sort order']."\n" ?>
<br /><select name="sort_dir">
<option value="DESC"><?php echo $lang_search['Descending'] ?></option>
<option value="ASC"><?php echo $lang_search['Ascending'] ?></option>
</select>
<br /></label>
<label class="conl"><?php echo $lang_search['Show as']."\n" ?>
<br /><select name="show_as">
<option value="topics"><?php echo $lang_search['Show as topics'] ?></option>
<option value="posts"><?php echo $lang_search['Show as posts'] ?></option>
</select>
<br /></label>
<p class="clearb"><?php echo $lang_search['Search results info'] ?></p>
</div>
</fieldset>
</div>
<p class="buttons"><input type="submit" name="search" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
</form>
</div>
</div>
<?php
require PUN_ROOT.'footer.php';viewtopic.php
<?php
/**
* Copyright (C) 2008-2010 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view']);
$action = isset($_GET['action']) ? $_GET['action'] : null;
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0;
if ($id < 1 && $pid < 1)
message($lang_common['Bad request']);
// Load the viewtopic.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
// If a post ID is specified we determine topic ID and page number so we can redirect to the correct message
if ($pid)
{
$result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$id = $db->result($result);
// Determine on what page the post is located (depending on $pun_user['disp_posts'])
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$num_posts = $db->num_rows($result);
for ($i = 0; $i < $num_posts; ++$i)
{
$cur_id = $db->result($result, $i);
if ($cur_id == $pid)
break;
}
++$i; // we started at 0
$_GET['p'] = ceil($i / $pun_user['disp_posts']);
}
// If action=new, we redirect to the first new post (if any)
else if ($action == 'new')
{
if (!$pun_user['is_guest'])
{
// We need to check if this topic has been viewed recently by the user
$tracked_topics = get_tracked_topics();
$last_viewed = isset($tracked_topics['topics'][$id]) ? $tracked_topics['topics'][$id] : $pun_user['last_visit'];
$result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted>'.$last_viewed) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$first_new_post_id = $db->result($result);
if ($first_new_post_id)
{
header('Location: viewtopic.php?pid='.$first_new_post_id.'#p'.$first_new_post_id);
exit;
}
}
// If there is no new post, we go to the last post
header('Location: viewtopic.php?id='.$id.'&action=last');
exit;
}
// If action=last, we redirect to the last post
else if ($action == 'last')
{
$result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$last_post_id = $db->result($result);
if ($last_post_id)
{
header('Location: viewtopic.php?pid='.$last_post_id.'#p'.$last_post_id);
exit;
}
}
// Fetch some info about the topic
if (!$pun_user['is_guest'])
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$cur_topic = $db->fetch_assoc($result);
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_topic['moderators'] != '') ? unserialize($cur_topic['moderators']) : array();
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
// Can we or can we not post replies?
if ($cur_topic['closed'] == '0')
{
if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $is_admmod)
$post_link = "\t\t\t".'<p class="postlink conr"><a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a></p>'."\n";
else
$post_link = '';
}
else
{
$post_link = $lang_topic['Topic closed'];
if ($is_admmod)
$post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
$post_link = "\t\t\t".'<p class="postlink conr">'.$post_link.'</p>'."\n";
}
// Add/update this topic in our list of tracked topics
if (!$pun_user['is_guest'])
{
$tracked_topics = get_tracked_topics();
$tracked_topics['topics'][$id] = time();
set_tracked_topics($tracked_topics);
}
// Determine the post offset (based on $_GET['p'])
$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']);
$start_from = $pun_user['disp_posts'] * ($p - 1);
// Generate paging links
$paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'viewtopic.php?id='.$id);
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
$quickpost = false;
if ($pun_config['o_quickpost'] == '1' &&
!$pun_user['is_guest'] &&
($cur_topic['post_replies'] == '1' || ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1')) &&
($cur_topic['closed'] == '0' || $is_admmod))
{
$required_fields = array('req_message' => $lang_common['Message']);
$quickpost = true;
}
if (!$pun_user['is_guest'] && $pun_config['o_subscriptions'] == '1')
{
if ($cur_topic['is_subscribed'])
// I apologize for the variable naming here. It's a mix of subscription and action I guess :-)
$subscraction = "\t\t".'<p class="subscribelink clearb"><span>'.$lang_topic['Is subscribed'].' - </span><a href="misc.php?unsubscribe='.$id.'">'.$lang_topic['Unsubscribe'].'</a></p>'."\n";
else
$subscraction = "\t\t".'<p class="subscribelink clearb"><a href="misc.php?subscribe='.$id.'">'.$lang_topic['Subscribe'].'</a></p>'."\n";
}
else
$subscraction = '';
if ($pun_config['o_feed_type'] == '1')
$page_head = array('feed' => '<link rel="alternate" type="application/rss+xml" href="extern.php?action=feed&tid='.$id.'&type=rss" title="'.$lang_common['RSS topic feed'].'" />');
else if ($pun_config['o_feed_type'] == '2')
$page_head = array('feed' => '<link rel="alternate" type="application/atom+xml" href="extern.php?action=feed&tid='.$id.'&type=atom" title="'.$lang_common['Atom topic feed'].'" />');
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), pun_htmlspecialchars($cur_topic['forum_name']), pun_htmlspecialchars($cur_topic['subject']));
define('PUN_ALLOW_INDEX', 1);
define('PUN_ACTIVE_PAGE', 'index');
require PUN_ROOT.'header.php';
?>
<div class="linkst">
<div class="inbox crumbsplus">
<ul class="crumbs">
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
<li><span>» </span><a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li>
<li><span>» </span><strong><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></strong></li>
</ul>
<div class="pagepost">
<p class="pagelink conl"><?php echo $paging_links ?></p>
<?php echo $post_link ?>
</div>
<div class="clearer"></div>
</div>
</div>
<?php
require PUN_ROOT.'include/parser.php';
$post_count = 0; // Keep track of post numbers
// Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id LIMIT '.$start_from.','.$pun_user['disp_posts']) or error('Unable to fetch post IDs', __FILE__, __LINE__, $db->error());
$post_ids = array();
for ($i = 0;$cur_post_id = $db->result($result, $i);$i++)
$post_ids[] = $cur_post_id;
// Retrieve the posts (and their respective poster/online status)
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, g.g_color, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
while ($cur_post = $db->fetch_assoc($result))
{
$post_count++;
$user_avatar = '';
$user_info = array();
$user_contacts = array();
$post_actions = array();
$is_online = '';
$signature = '';
// If the poster is a registered user
if ($cur_post['poster_id'] > 1)
{
$colorspan = (!empty($cur_post['g_color'])) ? '<span style="color:'.$cur_post['g_color'].'; font-weight:bold">' : '';
$colorspan2 = (!empty($cur_post['g_color'])) ? '</span>' : '';
if ($pun_user['g_view_users'] == '1')
{
$username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.$colorspan.pun_htmlspecialchars($cur_post['username']).$colorspan2.'</a>';
}
else
{
$username = $colorspan.pun_htmlspecialchars($cur_post['username']).$colorspan2;
}
$user_title = get_title($cur_post);
if ($pun_config['o_censoring'] == '1')
$user_title = censor_words($user_title);
// Format the online indicator
$is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : '<span>'.$lang_topic['Offline'].'</span>';
if ($pun_config['o_avatars'] == '1' && $pun_user['show_avatars'] != '0')
{
if (isset($user_avatar_cache[$cur_post['poster_id']]))
$user_avatar = $user_avatar_cache[$cur_post['poster_id']];
else
$user_avatar = $user_avatar_cache[$cur_post['poster_id']] = generate_avatar_markup($cur_post['poster_id']);
}
// We only show location, register date, post count and the contact links if "Show user info" is enabled
if ($pun_config['o_show_user_info'] == '1')
{
if ($cur_post['location'] != '')
{
if ($pun_config['o_censoring'] == '1')
$cur_post['location'] = censor_words($cur_post['location']);
$user_info[] = '<dd><span>'.$lang_topic['From'].' '.pun_htmlspecialchars($cur_post['location']).'</span></dd>';
}
$user_info[] = '<dd><span>'.$lang_topic['Registered'].' '.format_time($cur_post['registered'], true).'</span></dd>';
if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod'])
$user_info[] = '<dd><span>'.$lang_topic['Posts'].' '.forum_number_format($cur_post['num_posts']).'</span></dd>';
// Now let's deal with the contact links (Email and URL)
if ((($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) || $pun_user['is_admmod']) && $pun_user['g_send_email'] == '1')
$user_contacts[] = '<span class="email"><a href="mailto:'.$cur_post['email'].'">'.$lang_common['Email'].'</a></span>';
else if ($cur_post['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
$user_contacts[] = '<span class="email"><a href="misc.php?email='.$cur_post['poster_id'].'">'.$lang_common['Email'].'</a></span>';
if ($cur_post['url'] != '')
{
if ($pun_config['o_censoring'] == '1')
$cur_post['url'] = censor_words($cur_post['url']);
$user_contacts[] = '<span class="website"><a href="'.pun_htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a></span>';
}
}
if ($pun_user['is_admmod'])
{
$user_info[] = '<dd><span><a href="moderate.php?get_host='.$cur_post['id'].'" title="'.$cur_post['poster_ip'].'">'.$lang_topic['IP address logged'].'</a></span></dd>';
if ($cur_post['admin_note'] != '')
$user_info[] = '<dd><span>'.$lang_topic['Note'].' <strong>'.pun_htmlspecialchars($cur_post['admin_note']).'</strong></span></dd>';
}
}
// If the poster is a guest (or a user that has been deleted)
else
{
$colorspan = (!empty($cur_post['g_color'])) ? '<span style="color:'.$cur_post['g_color'].'; font-weight:bold">' : '';
$colorspan2 = (!empty($cur_post['g_color'])) ? '</span>' : '';
$username = $colorspan.pun_htmlspecialchars($cur_post['username']).$colorspan2;
$user_title = get_title($cur_post);
if ($pun_user['is_admmod'])
$user_info[] = '<dd><span><a href="moderate.php?get_host='.$cur_post['id'].'" title="'.$cur_post['poster_ip'].'">'.$lang_topic['IP address logged'].'</a></span></dd>';
if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
$user_contacts[] = '<span class="email"><a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['Email'].'</a></span>';
}
// Generation post action array (quote, edit, delete etc.)
if (!$is_admmod)
{
if (!$pun_user['is_guest'])
$post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a></span></li>';
if ($cur_topic['closed'] == '0')
{
if ($cur_post['poster_id'] == $pun_user['id'])
{
if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
$post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a></span></li>';
if ($pun_user['g_edit_posts'] == '1')
$post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span></li>';
}
if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
$post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a></span></li>';
}
}
else
{
$post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a></span></li>';
$post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a></span></li>';
$post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span></li>';
$post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a></span></li>';
}
// Perform the main parsing of the message (BBCode, smilies, censor words etc)
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
// Do signature parsing/caching
if ($pun_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $pun_user['show_sig'] != '0')
{
if (isset($signature_cache[$cur_post['poster_id']]))
$signature = $signature_cache[$cur_post['poster_id']];
else
{
$signature = parse_signature($cur_post['signature']);
$signature_cache[$cur_post['poster_id']] = $signature;
}
}
?>
<div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?><?php if ($cur_post['id'] == $cur_topic['first_post_id']) echo ' firstpost'; ?><?php if ($post_count == 1) echo ' blockpost1'; ?>">
<h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?></span> <a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2>
<div class="box">
<div class="inbox">
<div class="postbody">
<div class="postleft">
<dl>
<dt><strong><?php echo $username ?></strong></dt>
<dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>
<?php if ($user_avatar != '') echo "\t\t\t\t\t\t".'<dd class="postavatar">'.$user_avatar.'</dd>'."\n"; ?>
<?php if (count($user_info)) echo "\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $user_info)."\n"; ?>
<?php if (count($user_contacts)) echo "\t\t\t\t\t\t".'<dd class="usercontacts">'.implode(' ', $user_contacts).'</dd>'."\n"; ?>
</dl>
</div>
<div class="postright">
<h3><?php if ($cur_post['id'] != $cur_topic['first_post_id']) echo $lang_topic['Re'].' '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3>
<div class="postmsg">
<?php echo $cur_post['message']."\n" ?>
<?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>
</div>
<?php if ($signature != '') echo "\t\t\t\t\t".'<div class="postsignature postmsg"><hr />'.$signature.'</div>'."\n"; ?>
</div>
</div>
</div>
<div class="inbox">
<div class="postfoot clearb">
<div class="postfootleft"><?php if ($cur_post['poster_id'] > 1) echo '<p>'.$is_online.'</p>'; ?></div>
<?php if (count($post_actions)) echo "\t\t\t\t".'<div class="postfootright">'."\n\t\t\t\t\t".'<ul>'."\n\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $post_actions)."\n\t\t\t\t\t".'</ul>'."\n\t\t\t\t".'</div>'."\n" ?>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="postlinksb">
<div class="inbox crumbsplus">
<div class="pagepost">
<p class="pagelink conl"><?php echo $paging_links ?></p>
<?php echo $post_link ?>
</div>
<ul class="crumbs">
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
<li><span>» </span><a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li>
<li><span>» </span><strong><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></strong></li>
</ul>
<?php echo $subscraction ?>
<div class="clearer"></div>
</div>
</div>
<?php
// Display quick post if enabled
if ($quickpost)
{
?>
<div id="quickpost" class="blockform">
<h2><span><?php echo $lang_topic['Quick post'] ?></span></h2>
<div class="box">
<form id="quickpostform" method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
<div class="inform">
<fieldset>
<legend><?php echo $lang_common['Write message legend'] ?></legend>
<div class="infldset txtarea">
<input type="hidden" name="form_sent" value="1" />
<input type="hidden" name="form_user" value="<?php echo pun_htmlspecialchars($pun_user['username']) ?>" />
<?php if ($pun_config['o_subscriptions'] == '1' && ($pun_user['auto_notify'] == '1' || $cur_topic['is_subscribed'])): ?> <input type="hidden" name="subscribe" value="1" />
<?php endif; ?> <label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
<ul class="bblinks">
<li><span><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
<li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
<li><span><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
</ul>
</div>
</fieldset>
</div>
<p class="buttons"><input type="submit" name="submit" tabindex="2" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
</form>
</div>
</div>
<?php
}
// Increment "num_views" for topic
if ($pun_config['o_topic_views'] == '1')
$db->query('UPDATE '.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
$forum_id = $cur_topic['forum_id'];
$footer_style = 'viewtopic';
require PUN_ROOT.'footer.php';post.php
<?php
/**
* Copyright (C) 2008-2010 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view']);
$tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
$fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0)
message($lang_common['Bad request']);
// Fetch some info about the topic and/or the forum
if ($tid)
$result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$cur_posting = $db->fetch_assoc($result);
$is_subscribed = $tid && $cur_posting['is_subscribed'];
// Is someone trying to post into a redirect forum?
if ($cur_posting['redirect_url'] != '')
message($lang_common['Bad request']);
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
if ($tid && $pun_config['o_censoring'] == '1')
$cur_posting['subject'] = censor_words($cur_posting['subject']);
// Do we have permission to post?
if ((($tid && (($cur_posting['post_replies'] == '' && $pun_user['g_post_replies'] == '0') || $cur_posting['post_replies'] == '0')) ||
($fid && (($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) ||
(isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) &&
!$is_admmod)
message($lang_common['No permission']);
// Load the post.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
// Start with a clean slate
$errors = array();
// Did someone just hit "Submit" or "Preview"?
if (isset($_POST['form_sent']))
{
// Make sure form_user is correct
if (($pun_user['is_guest'] && $_POST['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']))
message($lang_common['Bad request']);
// Flood protection
if (!isset($_POST['preview']) && $pun_user['last_post'] != '' && (time() - $pun_user['last_post']) < $pun_user['g_post_flood'])
$errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood'].' '.$lang_post['flood end'];
// If it's a new topic
if ($fid)
{
$subject = pun_trim($_POST['req_subject']);
if ($subject == '')
$errors[] = $lang_post['No subject'];
else if (pun_strlen($subject) > 70)
$errors[] = $lang_post['Too long subject'];
else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod'])
$errors[] = $lang_post['All caps subject'];
}
// If the user is logged in we get the username and email from $pun_user
if (!$pun_user['is_guest'])
{
$username = $pun_user['username'];
$email = $pun_user['email'];
}
// Otherwise it should be in $_POST
else
{
$username = pun_trim($_POST['req_username']);
$email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));
// Load the register.php/profile.php language files
require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';
// It's a guest, so we have to validate the username
check_username($username);
if ($pun_config['p_force_guest_email'] == '1' || $email != '')
{
require PUN_ROOT.'include/email.php';
if (!is_valid_email($email))
$errors[] = $lang_common['Invalid email'];
// Check if it's a banned email address
// we should only check guests because members addresses are already verified
if ($pun_user['is_guest'] && is_banned_email($email))
{
if ($pun_config['p_allow_banned_email'] == '0')
$errors[] = $lang_prof_reg['Banned email'];
$banned_email = true; // Used later when we send an alert email
}
else
$banned_email = false;
}
}
// Clean up message from POST
$message = pun_linebreaks(pun_trim($_POST['req_message']));
// Here we use strlen() not pun_strlen() as we want to limit the post to PUN_MAX_POSTSIZE bytes, not characters
if (strlen($message) > PUN_MAX_POSTSIZE)
$errors[] = sprintf($lang_post['Too long message'], forum_number_format(PUN_MAX_POSTSIZE));
else if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod'])
$errors[] = $lang_post['All caps message'];
// Validate BBCode syntax
if ($pun_config['p_message_bbcode'] == '1')
{
require PUN_ROOT.'include/parser.php';
$message = preparse_bbcode($message, $errors);
}
if ($message == '')
$errors[] = $lang_post['No message'];
$hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0';
$subscribe = isset($_POST['subscribe']) ? '1' : '0';
$now = time();
// Did everything go according to plan?
if (empty($errors) && !isset($_POST['preview']))
{
require PUN_ROOT.'include/search_idx.php';
// If it's a reply
if ($tid)
{
if (!$pun_user['is_guest'])
{
$new_tid = $tid;
// Insert the new post
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
// To subscribe or not to subscribe, that ...
if ($pun_config['o_subscriptions'] == '1')
{
if ($subscribe && !$is_subscribed)
$db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
else if (!$subscribe && $is_subscribed)
$db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());
}
}
else
{
// It's a guest. Insert the new post
$email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
}
// Count number of replies in the topic
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$tid) or error('Unable to fetch post count for topic', __FILE__, __LINE__, $db->error());
$num_replies = $db->result($result, 0) - 1;
// Update topic
$db->query('UPDATE '.$db->prefix.'topics SET num_replies='.$num_replies.', last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.$db->escape($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
update_search_index('post', $new_pid, $message);
update_forum($cur_posting['id']);
// Should we send out notifications?
if ($pun_config['o_subscriptions'] == '1')
{
// Get the post time for the previous post in this topic
$result = $db->query('SELECT posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$previous_post_time = $db->result($result);
// Get any subscribed users that should be notified (banned users are excluded)
$result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'subscriptions AS s ON u.id=s.user_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id='.$cur_posting['id'].' AND fp.group_id=u.group_id) LEFT JOIN '.$db->prefix.'online AS o ON u.id=o.user_id LEFT JOIN '.$db->prefix.'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>'.$previous_post_time.' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id='.$tid.' AND u.id!='.$pun_user['id']) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
require_once PUN_ROOT.'include/email.php';
$notification_emails = array();
// Loop through subscribed users and send emails
while ($cur_subscriber = $db->fetch_assoc($result))
{
// Is the subscription email for $cur_subscriber['language'] cached or not?
if (!isset($notification_emails[$cur_subscriber['language']]))
{
if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))
{
// Load the "new reply" template
$mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'));
// Load the "new reply full" template (with post included)
$mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply_full.tpl'));
// The first row contains the subject (it also starts with "Subject:")
$first_crlf = strpos($mail_tpl, "\n");
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
$mail_message = trim(substr($mail_tpl, $first_crlf));
$first_crlf = strpos($mail_tpl_full, "\n");
$mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));
$mail_message_full = trim(substr($mail_tpl_full, $first_crlf));
$mail_subject = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject);
$mail_message = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message);
$mail_message = str_replace('<replier>', $username, $mail_message);
$mail_message = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message);
$mail_message = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message);
$mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
$mail_subject_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject_full);
$mail_message_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message_full);
$mail_message_full = str_replace('<replier>', $username, $mail_message_full);
$mail_message_full = str_replace('<message>', $message, $mail_message_full);
$mail_message_full = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message_full);
$mail_message_full = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message_full);
$mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);
$notification_emails[$cur_subscriber['language']][0] = $mail_subject;
$notification_emails[$cur_subscriber['language']][1] = $mail_message;
$notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
$notification_emails[$cur_subscriber['language']][3] = $mail_message_full;
$mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
}
}
// We have to double check here because the templates could be missing
if (isset($notification_emails[$cur_subscriber['language']]))
{
if ($cur_subscriber['notify_with_post'] == '0')
pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
else
pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
}
}
}
}
}
// If it's a new topic
else if ($fid)
{
// Create the topic
$db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
$new_tid = $db->insert_id();
if (!$pun_user['is_guest'])
{
// To subscribe or not to subscribe, that ...
if ($pun_config['o_subscriptions'] == '1' && $subscribe)
$db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
// Create the post ("topic post")
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
}
else
{
// Create the post ("topic post")
$email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
}
$new_pid = $db->insert_id();
// Update the topic with last_post_id
$db->query('UPDATE '.$db->prefix.'topics SET last_post_id='.$new_pid.', first_post_id='.$new_pid.' WHERE id='.$new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
update_search_index('post', $new_pid, $message, $subject);
update_forum($fid);
}
// If we previously found out that the email was banned
if ($pun_user['is_guest'] && $banned_email && $pun_config['o_mailing_list'] != '')
{
$mail_subject = $lang_common['Banned email notification'];
$mail_message = sprintf($lang_common['Banned email post message'], $username, $email)."\n";
$mail_message .= sprintf($lang_common['Post URL'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid)."\n";
$mail_message .= "\n".'--'."\n".$lang_common['Email signature'];
pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
}
// If the posting user is logged in, increment his/her post count
if (!$pun_user['is_guest'])
{
$db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
$tracked_topics = get_tracked_topics();
$tracked_topics['topics'][$new_tid] = time();
set_tracked_topics($tracked_topics);
}
else
{
$db->query('UPDATE '.$db->prefix.'online SET last_post='.$now.' WHERE ident=\''.$db->escape(get_remote_address()).'\'' ) or error('Unable to update user', __FILE__, __LINE__, $db->error());
}
redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect']);
}
}
// If a topic ID was specified in the url (it's a reply)
if ($tid)
{
$action = $lang_post['Post a reply'];
$form = '<form id="post" method="post" action="post.php?action=post&tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
// If a quote ID was specified in the url
if (isset($_GET['qid']))
{
$qid = intval($_GET['qid']);
if ($qid < 1)
message($lang_common['Bad request']);
$result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid.' AND topic_id='.$tid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($q_poster, $q_message) = $db->fetch_row($result);
$q_message = preg_replace('%\[img(?:=.*?)?\]%', '[url]', $q_message);
$q_message = str_replace('[/img]', '[/url]', $q_message);
if ($pun_config['o_censoring'] == '1')
$q_message = censor_words($q_message);
$q_message = pun_htmlspecialchars($q_message);
if ($pun_config['p_message_bbcode'] == '1')
{
// If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends)
if (strpos($q_poster, '[') !== false || strpos($q_poster, ']') !== false)
{
if (strpos($q_poster, '\'') !== false)
$q_poster = '"'.$q_poster.'"';
else
$q_poster = '\''.$q_poster.'\'';
}
else
{
// Get the characters at the start and end of $q_poster
$ends = substr($q_poster, 0, 1).substr($q_poster, -1, 1);
// Deal with quoting "Username" or 'Username' (becomes '"Username"' or "'Username'")
if ($ends == '\'\'')
$q_poster = '"'.$q_poster.'"';
else if ($ends == '""')
$q_poster = '\''.$q_poster.'\'';
}
$quote = '[quote='.$q_poster.']'.$q_message.'[/quote]'."\n";
}
else
$quote = '> '.$q_poster.' '.$lang_common['wrote']."\n\n".'> '.$q_message."\n";
}
}
// If a forum ID was specified in the url (new topic)
else if ($fid)
{
$action = $lang_post['Post new topic'];
$form = '<form id="post" method="post" action="post.php?action=post&fid='.$fid.'" onsubmit="return process_form(this)">';
}
else
message($lang_common['Bad request']);
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $action);
$required_fields = array('req_email' => $lang_common['Email'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
$focus_element = array('post');
if (!$pun_user['is_guest'])
$focus_element[] = ($fid) ? 'req_subject' : 'req_message';
else
{
$required_fields['req_username'] = $lang_post['Guest name'];
$focus_element[] = 'req_username';
}
define('PUN_ACTIVE_PAGE', 'index');
require PUN_ROOT.'header.php';
?>
<div class="linkst">
<div class="inbox">
<ul class="crumbs">
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
<li><span>» </span><a href="viewforum.php?id=<?php echo $cur_posting['id'] ?>"><?php echo pun_htmlspecialchars($cur_posting['forum_name']) ?></a></li>
<?php if (isset($cur_posting['subject'])): ?> <li><span>» </span><a href="viewtopic.php?id=<?php echo $tid ?>"><?php echo pun_htmlspecialchars($cur_posting['subject']) ?></a></li>
<?php endif; ?> <li><span>» </span><strong><?php echo $action ?></strong></li>
</ul>
</div>
</div>
<?php
// If there are errors, we display them
if (!empty($errors))
{
?>
<div id="posterror" class="block">
<h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
<div class="box">
<div class="inbox error-info">
<p><?php echo $lang_post['Post errors info'] ?></p>
<ul class="error-list">
<?php
foreach ($errors as $cur_error)
echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
?>
</ul>
</div>
</div>
</div>
<?php
}
else if (isset($_POST['preview']))
{
require_once PUN_ROOT.'include/parser.php';
$preview_message = parse_message($message, $hide_smilies);
?>
<div id="postpreview" class="blockpost">
<h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
<div class="box">
<div class="inbox">
<div class="postbody">
<div class="postright">
<div class="postmsg">
<?php echo $preview_message."\n" ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
$cur_index = 1;
?>
<div id="postform" class="blockform">
<h2><span><?php echo $action ?></span></h2>
<div class="box">
<?php echo $form."\n" ?>
<div class="inform">
<fieldset>
<legend><?php echo $lang_common['Write message legend'] ?></legend>
<div class="infldset txtarea">
<input type="hidden" name="form_sent" value="1" />
<input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
<?php
if ($pun_user['is_guest'])
{
$email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['Email'].' <span>'.$lang_common['Required'].'</span></strong>' : $lang_common['Email'];
$email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
?>
<label class="conl required"><strong><?php echo $lang_post['Guest name'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
<label class="conl<?php echo ($pun_config['p_force_guest_email'] == '1') ? ' required' : '' ?>"><?php echo $email_label ?><br /><input type="text" name="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="50" maxlength="80" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
<div class="clearer"></div>
<?php
}
if ($fid): ?>
<label class="required"><strong><?php echo $lang_common['Subject'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
<?php endif; ?> <label class="required"><strong><?php echo $lang_common['Message'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br />
<textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea><br /></label>
<ul class="bblinks">
<li><span><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
<li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
<li><span><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
</ul>
</div>
</fieldset>
<?php
$checkboxes = array();
if (!$pun_user['is_guest'])
{
if ($pun_config['o_smilies'] == '1')
$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'].'<br /></label>';
if ($pun_config['o_subscriptions'] == '1')
{
$subscr_checked = false;
// If it's a preview
if (isset($_POST['preview']))
$subscr_checked = isset($_POST['subscribe']) ? true : false;
// If auto subscribed
else if ($pun_user['auto_notify'])
$subscr_checked = true;
// If already subscribed to the topic
else if ($is_subscribed)
$subscr_checked = true;
$checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.($subscr_checked ? ' checked="checked"' : '').' />'.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']).'<br /></label>';
}
}
else if ($pun_config['o_smilies'] == '1')
$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'].'<br /></label>';
if (!empty($checkboxes))
{
?>
</div>
<div class="inform">
<fieldset>
<legend><?php echo $lang_common['Options'] ?></legend>
<div class="infldset">
<div class="rbox">
<?php echo implode("\n\t\t\t\t\t\t\t", $checkboxes)."\n" ?>
</div>
</div>
</fieldset>
<?php
}
?>
</div>
<p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
</form>
</div>
</div>
<?php
// Check to see if the topic review is to be displayed
if ($tid && $pun_config['o_topic_review'] != '0')
{
require_once PUN_ROOT.'include/parser.php';
$result = $db->query('SELECT p.poster, p.message, p.hide_smilies, p.posted, g.g_color FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE p.topic_id='.$tid.' ORDER BY p.id DESC LIMIT '.$pun_config['o_topic_review']) or error('Unable to fetch topic review', __FILE__, __LINE__, $db->error());
?>
<div id="postreview">
<h2><span><?php echo $lang_post['Topic review'] ?></span></h2>
<?php
// Set background switching on
$post_count = 0;
while ($cur_post = $db->fetch_assoc($result))
{
$post_count++;
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
$colorspan = (!empty($cur_post['g_color'])) ? '<span style="color:'.$cur_post['g_color'].'; font-weight:bold">' : '';
$colorspan2 = (!empty($cur_post['g_color'])) ? '</span>' : '';
?>
<div class="blockpost">
<div class="box<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
<div class="inbox">
<div class="postbody">
<div class="postleft">
<dl>
<dt><strong><?php echo $colorspan.pun_htmlspecialchars($cur_post['poster']).$colorspan2 ?></strong></dt>
<dd><span><?php echo format_time($cur_post['posted']) ?></span></dd>
</dl>
</div>
<div class="postright">
<div class="postmsg">
<?php echo $cur_post['message']."\n" ?>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php
}
require PUN_ROOT.'footer.php';Merci d'avance pour votre aide précieuse, car cela m'empêche d'avancer 
Hors ligne
... lorsque j'essaye d'installer la Mod, j'ai des erreurs sur les haut de pages...
Bonjour,
Quels sont les libellés exacts des erreurs ?
Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Gandhi
Sont différents : ça et sa - est et ait - à et a - ce et se - mes et mais ou met - été et était - c'est et ces - ce-si et ceci
La vie sans musique est tout simplement une erreur, une fatigue, un exil. Friedrich Nietzsche
Hors ligne
Exact pardon j'ai oublié cela 
search.php
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 246
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 251
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/search.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 20viewtopic.php
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 246
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 251
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 246
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 251
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/viewtopic.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 20post.php
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 246
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/include/functions.php on line 251
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d292889573/htdocs/HasHD/B04rD/post.php:1) in /homepages/2/d292889573/htdocs/HasHD/B04rD/header.php on line 20Voilà 
Hors ligne
Bonjour,
Première chose à faire (Je subodore fortement que ça vienne de là !) est de vérifier que les trois fichiers cités* n'ont pas été enregistrés en utf-8 AVEC BOM.
Voir : header already sent
*Vérifier également les autres fichiers, car ça peut également provenir d'un fichier include.
Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Gandhi
Sont différents : ça et sa - est et ait - à et a - ce et se - mes et mais ou met - été et était - c'est et ces - ce-si et ceci
La vie sans musique est tout simplement une erreur, une fatigue, un exil. Friedrich Nietzsche
Hors ligne
heu... désolé de paraitre idiot, mais j'y comprends rien là.
Hors ligne
As-tu été LIRE le lien cité qui est rédigé en français.
Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Gandhi
Sont différents : ça et sa - est et ait - à et a - ce et se - mes et mais ou met - été et était - c'est et ces - ce-si et ceci
La vie sans musique est tout simplement une erreur, une fatigue, un exil. Friedrich Nietzsche
Hors ligne
Oui, mais je n'y comprends rien 
Hors ligne
Le lien qui t'as été donner était pour que tu en apprenne plus ... dommage que tu n'y comprenne rien.
Dans notepad ++,tu édites le fichier voulu puis onglet encodage, ensuite tu choisis "encoder en UTF-8 (sans BOM)" et là ça sera bon.
Hors ligne
Bonsoir,
La modification Color-Of-Groups a été téléchargée 587 fois et n'a suscité aucune remarque d'erreurs comme les tiennes ; ce qui veut dire que le problème provient de la manière dont tu installes la modification.
Avec quel logiciel modifies-tu les fichiers ?
Comment les sauvegardes-tu une fois modifiés ?
Vérifies-tu le type du fichier qui sera sauvegardé ?
Utilise, comme préconisé dans mon explication, l'éditeur de texte Notepad++ et vérifie, dans la ligne d'état, quel est le type d'encodage des fichiers : Ce ne doit être que ANSI ou ANSI as UTF-8, mais surtout pas UTF-8 tout court.
Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Gandhi
Sont différents : ça et sa - est et ait - à et a - ce et se - mes et mais ou met - été et était - c'est et ces - ce-si et ceci
La vie sans musique est tout simplement une erreur, une fatigue, un exil. Friedrich Nietzsche
Hors ligne
Le support des mods se réalise dans la discussion qui lui ait associée ==> http://fluxbb.fr/forums/viewtopic.php?id=10818
Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne