i agree maybe if we throw in a div or a <p id=" was how it was suppose to be.
Q
You are not logged in. Please login or register.
PunBB Forums → Posts by quaker
i agree maybe if we throw in a div or a <p id=" was how it was suppose to be.
Q
it set the amount of txt to view i removed some of the script to display read more below the txt area. and left it to the block at the bottom.
well the javascript over rides the echo to print all the txt. by setting that id=
mattf me and fsx worked on the issue with that code.. and got all kind of issue..
so i went and got a simpler javascript to do the function of truncate.
Q
mattf we tried that and got all kinds of error
so i got one that works good.
Q
ok ok i got the truncate working...haha... i had to find a javascript to handle it.. it is rough but works.... here is my code
<style>
.news_subject {
background-color: inherit;
font-family: Tahoma, Verdana, "Lucida Sans Unicode", Arial, sans-serif;
font-size: 1.2em;
font-weight: bold;
text-decoration:none;
border-bottom:1px dotted #065C7C
}
a.news_subject:hover {
background-color: inherit;
color: #000000;
text-decoration: none;
border-bottom:1px solid #065C7C
}
.news_footer {
background-color: #DBE9EC;
color: inherit;
border-bottom: 1px solid #BBCEDE;
border-right: 1px solid #BBCEDE;
}
</style>
<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
global $lang_common, $db, $pun_config, $pun_user, $db_prefix;
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.poster AS username, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<script type="text/javascript">
var len = 200;
var p = document.getElementById('truncateMe');
if (p) {
var trunc = p.innerHTML;
if (trunc.length > len) {
/* Truncate the content of the P, then go back to the end of the
previous word to ensure that we don't truncate in the middle of
a word */
trunc = trunc.substring(0, len);
trunc = trunc.replace(/\w+$/, '');
/* Add an ellipses to the end and make it a link that expands
the paragraph back to its original size */
trunc += '<a href="#" ' +
'onclick="this.parentNode.innerHTML=' +
'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
'...<\/a>';
p.innerHTML = trunc;
}
}
</script>
<div class="block">
<?php
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
}
else
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border: 0px;" width="90%"id="truncateMe"><?php echo $cur_post['message']."\n" ?></td>
<td align="right" style="border: 0px;" width="10%" valign="top"><?php echo $user_avatar ?></td>
</tr>
</table>
<br />
<br />
<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<?php
echo "\t\t\t\t\t\t\t".'<span class="byuser" style="float:left">Posted on: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.'</a></span>'."\n\n\n\n";
?>
</td>
</tr>
</table>
</ul>
</div>
</div>
</div>
<?
}
}
else
{
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
kierownik, im trying to understand that mod (another captcha mod) so i just started adding lines and debug it at the same time. im getting hit my spam threw my contact.php so ....
anything worth a try to stop it.
Q
new updated photos....
this is on my localhost and the forum width is 550px so that why it looks crunched.
this is for members and admin
this is for guest
if someone see a fix for my file would you mind pointing out the error and reposting the fixed script?
that way we can track the progress of this file?
Thanks
Q
pbb_gallery
or my lightbox gallery.
search punres.org
Q
im working on a contact.php with captcha mod for it.
i got it displaying the captcha box and u can input it. and even on refresh it changes the code.
but the issue im running in to is when you submit u can do it without the captcha
i'm using the another pun captcha mod in my site for the register.php
can some one HELP ME?
Q
here is my code
<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / Contact'; //Set the page title here
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
session_start();
//echo "<PRE>"; print_r ($pun_config); echo "</PRE>";
if ($_POST[form_sent] == 1) {
//Process The Form
?>
<?php
$recipient = "$toName <".$toMail.">";
$headers ="From: ".$_POST[name]." <".$_POST[email].">";
$subject = "WEBFORM:".$_POST[subject];
$message = str_replace("\\", "", $_POST[comments]);
mail($pun_config['o_admin_email'], $subject, $message, $headers);
if( ($_SESSION['security_code'] != $_POST['security_code']) || empty($_SESSION['security_code'] ) ) {
message($lang_prof_reg['Bad security code']);
}
?>
<div class="blockform">
<h2><span>Contact <?php echo $pun_config['o_board_title']; ?></span></h2>
<div class="box">
<form id="contact" method="post" action="contact.php">
<div class="inform">
<fieldset>
<legend>Email Sent</legend>
<div class="infldset">
<b>Thank you for contacting us!</b> The following information was sent to <?php echo $pun_config['o_board_title']; ?>.<br /><br />
<label>Name:<br /><?php echo $_POST[name]; ?><br /></label>
<label>Email:<br /><?php echo $_POST[email]; ?><br /></label>
<label>Subject:<br /><?php echo $_POST[subject]; ?><br /></label>
<label>Comments:<br /><?php echo $_POST[comments]; ?><br /></label>
</div>
</fieldset>
</div>
</form>
</div>
</div>
<?php } else {
//Display the Form
?>
<div class="blockform">
<h2><span>Contact <?php echo $pun_config['o_board_title']; ?></span></h2>
<div class="box">
<form id="contact" method="post" action="contact.php">
<div class="inform">
<fieldset>
<legend>Enter your contact details</legend>
<div class="infldset">
Please enter your contact information and comments here. If you would like to share your comments with everyone, consider posting them on the <a href="forum.php">forum</a> instead!<br />
<input type="hidden" name="form_sent" value="1" /><br />
<label>Name<br /><input type="text" name="name" value="" size="40" maxlength="40" /><br /></label>
<label>Email<br /><input type="text" name="email" value="" size="40" maxlength="50" /><br /></label>
<label>Subject<br /><input type="text" name="subject" value="" size="40" maxlength="50" /><br /></label>
<label>Comments<br /><textarea name="comments" rows="5" cols="40"></textarea><br /></label>
</div>
</fieldset>
</div>
<div class="inform">
<fieldset>
<legend><?php echo $lang_prof_reg['Security code legend'] ?></legend>
<div class="infldset">
<p><img src="captcha/CaptchaSecurityImages.php?width=100&height=40&characters=5" /></p>
<div class="rbox">
<label><input id="security_code" name="security_code" type="text" /></label>
</div>
</div>
</fieldset>
</div>
<p><input type="submit" name="update" value="Submit" /></p>
</form>
</div>
</div>
<?php
} //close if statement
require PUN_ROOT.'footer.php';
kewl... maybe one day..hahaha...
Q
true... i just too the code out and it works like a charm... I want to thank everyone that helped on this...
this was my truly fist go at a mod and it turned out good.
thanks again !
Q
bing there is an issue if people dont have the avatar mod installed it will show up as a blank picture in ie7
this is the line that i removed on mine
<?php echo $user_avatar ?>
Q
bing if you look at the code that validates. u will notice that it not displaying the user name that posted the article.
Posted on: 2007-01-17 12:06:20 by: | Views: 7 | Replies: 0 that what i see in ie7 and FF!
<a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a>
thanks for everyone help on this..... but now im going to recode it for miniportal take it back to the way i had it first looking...
truncate kewl but a pain to fingure out... and specially when i dont know what im doing and it works..hahaha.....
so im going back to the first design i had.
Q
here the code for mega pun ..
<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
//$newsid = '1'; //This is the forum the news is retrieved from
//$newsdisplay = '5'; //This is how many news articles are displayed.
function pun_news($fid='', $show=15, $truncate=350)
{
global $lang_common, $db, $pun_config, $pun_user, $db_prefix;
$max_subject_length = 30;
$show_max_topics = 50;
$fid = intval($fid);
$order_by = 't.posted';
$forum_sql = '';
// Was a forum ID supplied?
if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
$show = intval($show);
if ($show < 1 || $show > $show_max_topics)
$show = 15;
$saveddate="";
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, g.g_color, u.use_avatar, f.id AS fid, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$show_count = 0;
if ( !$db->num_rows($result) ) return $output;
while ( ($show_count < $show) && ($cur_post = $db->fetch_assoc($result)) ) {
$temp = '';
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" />';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" />';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" />';
}
else
$user_avatar = '<img alt="" src="img/noimage.gif" />';
if ($pun_config['o_censoring'] == '1')
$cur_post['subject'] = censor_words($cur_post['subject']);
if (pun_strlen($cur_post['subject']) > $max_subject_length)
$subject_truncated = trim(substr($cur_post['subject'], 0, ($max_subject_length-5))).' ...';
else
$subject_truncated = $cur_post['subject'];
$newsheading = '<div style="margin-top:-8px;"><img style="vertical-align: middle;" src="img/'.$pun_user['style'].'/icon_passive.gif" alt="" /> <a class="news-links" href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'" title="'.pun_htmlspecialchars($cur_post['subject']).'"><b>'.pun_htmlspecialchars($subject_truncated).'</b></a><br />Posted by: <a href="profile.php?id='.$cur_post['poster_id'].'"><span style="color:'.$cur_post['g_color'].'">'.pun_htmlspecialchars($cur_post['poster']).'</span></a> at '.date('h:i A', $cur_post['posted']).'<br /><a style="font-weight: normal;" href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&action=last" title="'.pun_htmlspecialchars($cur_post['subject']).'">Comments: ('.$cur_post['num_replies'].')</a> | Reads: '.pun_htmlspecialchars($cur_post['num_views']).'</div>';
// Group posts by date
$thisdate = date('l, d F Y', $cur_post['posted']);
if ($thisdate != $saveddate)
{
if ($saveddate)
{
$temp .= "</div></div>";
}
$temp .= '<div class="block"><h2><span><b>News:</b> '.$thisdate.'</span></h2><div class="box"><div class="inbox"><br />';
$saveddate = $thisdate;
}
else {
$temp .= '<div class="inbox"><hr /><br />';
}
$temp .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td style="border: 0px; width: 80%;">'.$newsheading.'</td></tr>
<tr>
<td style="border: 0px;" valign="top" align="left">';
$id = $cur_post['id'];
$msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if ( !$db->num_rows($msg) ) continue;
$cur_post = $db->fetch_assoc($msg);
// Display first paragraph only (comment out next four lines to turn off)
if ($truncate)
{
$paragraph = '';
for ($numchar=0; $numchar<$truncate; $numchar++)
{
if (isset($cur_post['message'][$numchar]))
$paragraph .= $cur_post['message'][$numchar];
else break;
}
if ($numchar > 300){
$paragraph .= '...';
$cur_post['message'] = $paragraph;
}
$cur_post['message'] = parse_message($cur_post['message'], 0);
$temp .= ''.$cur_post['message'].'</td>
<td align="right" style="border: 0px; width: auto;"><a href="profile.php?id='.$cur_post['poster_id'].'">'.$user_avatar.'</a></td>
</tr>
</table><br />';
if ($numchar > 300){
$temp .= '<div style="width: auto; padding: 3px 0px 2px 5px; margin-bottom: 3px;" class="bookmarks_readmore"><span style="float: left;"><img src="../img/digg_icon.gif" alt="Digg!" title="Digg!" /> <a style="font-weight: normal;" href="http://digg.com/submit?phase=2&url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">Digg It</a> | <img src="../img/delicious_icon.gif" alt="del.icio.us" title="del.icio.us" /> <a style="font-weight: normal;" href="http://del.icio.us/post?url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">del.icio.us</a> </span><span style="float: right; margin-right: 6px; vertical-align: middle;">'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="edit.php?id='.$cur_post['id'].'">'.'Edit'.'</a>'.' | <a href="misc.php?report='.$cur_post['id'].'">'.'Report'.'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.'Delete'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.'Quote'.'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.' | </a></span>'.'</div></div>';
}else {
$temp .= '<div style="width: auto; padding: 3px 4px 2px 5px; margin-bottom: 3px;" class="bookmarks"><img src="../img/digg_icon.gif" alt="Digg!" title="Digg!" /> <a style="font-weight: normal;" href="http://digg.com/submit?phase=2&url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">Digg It</a> | <img src="../img/delicious_icon.gif" alt="del.icio.us" title="del.icio.us" /> <a style="font-weight: normal;" href="http://del.icio.us/post?url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">del.icio.us</a></div></div>';
}
}
if (isset($output)) {
$output .= $temp;
}
else {
$output = $temp;
}
++$show_count;
} // end of while
$output .= "</div></div>";
return $output;
}
if ($pun_config['o_index_message_show'] == 1)
{
?>
<?php
}
?>
<?php
echo pun_news(1, 5, 350);
require PUN_ROOT.'footer.php';
here what i got so far...
[b]now this is for only mega PUN ONLY!!!![/b
]
<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
//$newsid = '1'; //This is the forum the news is retrieved from
//$newsdisplay = '5'; //This is how many news articles are displayed.
function pun_news($fid='', $show=15, $truncate=350)
{
global $lang_common, $db, $pun_config, $pun_user, $db_prefix;
$max_subject_length = 30;
$show_max_topics = 50;
$fid = intval($fid);
$order_by = 't.posted';
$forum_sql = '';
// Was a forum ID supplied?
if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
$show = intval($show);
if ($show < 1 || $show > $show_max_topics)
$show = 15;
$saveddate="";
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, g.g_color, u.use_avatar, f.id AS fid, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$show_count = 0;
if ( !$db->num_rows($result) ) return $output;
while ( ($show_count < $show) && ($cur_post = $db->fetch_assoc($result)) ) {
$temp = '';
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" />';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" />';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" />';
}
else
$user_avatar = '<img alt="" src="img/noimage.gif" />';
if ($pun_config['o_censoring'] == '1')
$cur_post['subject'] = censor_words($cur_post['subject']);
if (pun_strlen($cur_post['subject']) > $max_subject_length)
$subject_truncated = trim(substr($cur_post['subject'], 0, ($max_subject_length-5))).' ...';
else
$subject_truncated = $cur_post['subject'];
$newsheading = '<div style="margin-top:-8px;"><img style="vertical-align: middle;" src="img/'.$pun_user['style'].'/icon_passive.gif" alt="" /> <a class="news-links" href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'" title="'.pun_htmlspecialchars($cur_post['subject']).'"><b>'.pun_htmlspecialchars($subject_truncated).'</b></a><br />Posted by: <a href="profile.php?id='.$cur_post['poster_id'].'"><span style="color:'.$cur_post['g_color'].'">'.pun_htmlspecialchars($cur_post['poster']).'</span></a> at '.date('h:i A', $cur_post['posted']).'<br /><a style="font-weight: normal;" href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&action=last" title="'.pun_htmlspecialchars($cur_post['subject']).'">Comments: ('.$cur_post['num_replies'].')</a> | Reads: '.pun_htmlspecialchars($cur_post['num_views']).'</div>';
// Group posts by date
$thisdate = date('l, d F Y', $cur_post['posted']);
if ($thisdate != $saveddate)
{
if ($saveddate)
{
$temp .= "</div></div>";
}
$temp .= '<div class="block"><h2><span><b>News:</b> '.$thisdate.'</span></h2><div class="box"><div class="inbox"><br />';
$saveddate = $thisdate;
}
else {
$temp .= '<div class="inbox"><hr /><br />';
}
$temp .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td style="border: 0px; width: 80%;">'.$newsheading.'</td></tr>
<tr>
<td style="border: 0px;" valign="top" align="left">';
$id = $cur_post['id'];
$msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if ( !$db->num_rows($msg) ) continue;
$cur_post = $db->fetch_assoc($msg);
// Display first paragraph only (comment out next four lines to turn off)
if ($truncate)
{
$paragraph = '';
for ($numchar=0; $numchar<$truncate; $numchar++)
{
if (isset($cur_post['message'][$numchar]))
$paragraph .= $cur_post['message'][$numchar];
else break;
}
if ($numchar > 300){
$paragraph .= '...';
$cur_post['message'] = $paragraph;
}
$cur_post['message'] = parse_message($cur_post['message'], 0);
$temp .= ''.$cur_post['message'].'</td>
<td align="right" style="border: 0px; width: auto;"><a href="profile.php?id='.$cur_post['poster_id'].'">'.$user_avatar.'</a></td>
</tr>
</table><br />';
if ($numchar > 300){
$temp .= '<div style="width: auto; padding: 3px 0px 2px 5px; margin-bottom: 3px;" class="bookmarks_readmore"><span style="float: left;"><img src="../img/digg_icon.gif" alt="Digg!" title="Digg!" /> <a style="font-weight: normal;" href="http://digg.com/submit?phase=2&url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">Digg It</a> | <img src="../img/delicious_icon.gif" alt="del.icio.us" title="del.icio.us" /> <a style="font-weight: normal;" href="http://del.icio.us/post?url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">del.icio.us</a> </span><span style="float: right; margin-right: 6px; vertical-align: middle;">'.'<a href="misc.php?report='.$cur_post['id'].'">'.'Report'.'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.'Delete'.'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.'</a></span>'.'</div></div>';
}else {
$temp .= '<div style="width: auto; padding: 3px 4px 2px 5px; margin-bottom: 3px;" class="bookmarks"><img src="../img/digg_icon.gif" alt="Digg!" title="Digg!" /> <a style="font-weight: normal;" href="http://digg.com/submit?phase=2&url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">Digg It</a> | <img src="../img/delicious_icon.gif" alt="del.icio.us" title="del.icio.us" /> <a style="font-weight: normal;" href="http://del.icio.us/post?url='.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'&title='.urlencode($cur_post['subject']).'">del.icio.us</a></div></div>';
}
}
if (isset($output)) {
$output .= $temp;
}
else {
$output = $temp;
}
++$show_count;
} // end of while
$output .= "</div></div>";
return $output;
}
if ($pun_config['o_index_message_show'] == 1)
{
?>
<?php
}
?>
<?php
echo pun_news(1, 5, 350);
require PUN_ROOT.'footer.php';
ok i have added the read more function.
<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
global $lang_common, $db, $pun_config, $pun_user, $db_prefix;
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.poster AS username, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="block">
<?php
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
}
else
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border: 0px;" width="90%"><?php echo $cur_post['message']."\n" ?></td>
<td align="right" style="border: 0px;" width="10%" valign="top"><?php echo $user_avatar ?></td>
</tr>
</table>
<br />
<br />
<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<?php
echo "\t\t\t\t\t\t\t".'<span class="byuser" style="float:left">Posted on: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.'</a></span>'."\n\n\n\n";
?>
</td>
</tr>
</table>
</ul>
</div>
</div>
</div>
<?
}
}
else
{
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
supermag, just create a new php file called test.php and copy code to it and try it out if u like it then rename index.php and rename test to index.php..
Q
kewl are you on msn?
Q
i ran into a issue with parse.php error once but i took out some code and it worked. i hope to continue working on this . my goal is to add the latest topics to the top of the page. sorta like the main page of http://bunpai.com but i got to figure out how to add another sql query to it. how to close that one and open a new one..haha...
this is a learning curve for me.
oh a side note im about to start another project with the contact.php . how can i add captcha to it. im starting to get spam threw that since my register is got captcha...ill post what code i got so far in a new threat. but it not finished nor does it work.
Q
i have added the quote functions...
<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="block">
<?php
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<?php echo $cur_post['message']."\n" ?><br /><br />
<?php
echo "\t\t\t\t\t\t\t".'<hr /><span class="byuser" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.'</span>'."\n\n\n\n";
?>
<br />
</ul>
</div>
</div>
</div>
<?
}
}
else
{
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
i see i need to add quote as well to the functions..haha
bling when i loaded it on http://bunpai.com/test12.php and i login i clicked edit
i can edit the post ... so what are you talking about ?
Q
PunBB Forums → Posts by quaker
Powered by PunBB, supported by Informer Technologies, Inc.