Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
stag
New Member
New Member


Joined: Jan 12, 2004
Posts: 22

PostPosted: Fri Jul 23, 2004 10:04 am Reply with quote

Hi,

Once again i am seeking the help of this forum as a last refuge. Can anyone tell me how to covert the following block into a module. I would be grateful if someone could post me the corrected index.php for the module i am trying to make with this block.

Quote:
<?php

########################################################################
# PHP-Nuke Block: Center Forum Posts Block v.1 #
# Re-coded for PHP-Nuke 6.5 #
# #
# Originally made by coldblooded Only registered users can see links on this board! Get registered or login! #
# Edited by William Wickings Only registered users can see links on this board! Get registered or login! #
# Modified by Gary Tomkinson Only registered users can see links on this board! Get registered or login! #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License. #
# If you modify this, let me know for fun. =) #
########################################################################

if (eregi("block-center-forum.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}

global $prefix, $dbi, $sitename, $admin;

$HideViewReadOnly = 1;
$ThemeSel = get_theme();
$Last_New_Topics = 40;
$show = " <tr>
<td height=\"25\" colspan=\"6\" align=\"center\" class=\"catbottom\" background=\"\">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";
$result = sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result, $dbi ) )

{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
list( $auth_view, $auth_read ) = sql_fetch_row( $result1, $dbi );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}

if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}

if( $skip_display == 0 )
{
$Count_Topics += 1;

$result2 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'", $dbi);
list($username, $user_id)=sql_fetch_row($result2, $dbi);
$avtor=$username;
$sifra=$user_id;

$result3 = sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%d/%m/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);

$result4 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result4, $dbi);

$viewlast .=" <tr>
<td height=\"30\" nowrap bgcolor=\"#FFFFFF\" class=\"row1\"><b>&nbsp;·&nbsp;</b></td>
<td width=\"100%\" bgcolor=\"#FFFFFF\" class=\"row1\">&nbsp;<a href=\"forums.html?file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row2\"><b>$topic_replies</b></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row3\"><a href=\"forums.html?file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap bgcolor=\"#FFFFFF\" class=\"row3\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
<a href=\"forums.html?file=profile&mode=viewprofile&u=$user_id\">$username</a>&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"></a></td>
</tr>";
}

if( $Last_New_Topics == $Count_Topics ) { break 1; }

}

$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"$bgcolor1\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" nowrap background=\"\" class=\"thcornerl\"><font color=\"#006699\"><strong>Latest Discussion Topics</strong></font></th>
<th width=\"50\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
<th width=\"100\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong>&nbsp;Author&nbsp;</strong></font></th>
<th width=\"50\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong>&nbsp;Views&nbsp;</strong></font></th>
<th align=\"center\" nowrap background=\"\" class=\"thcornerr\"><font color=\"#006699\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
</tr>";
$content .= "$viewlast";

$content .= "$show";

?>
 
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2496

PostPosted: Fri Jul 23, 2004 10:59 am Reply with quote

Code:


<?php

########################################################################
# PHP-Nuke Block: Center Forum Posts Block v.1 #
# Re-coded for PHP-Nuke 6.5 #
# #
# Originally made by coldblooded http://www.hellhole.org #
# Edited by William Wickings http://www.amateur-online.net #
# Modified by Gary Tomkinson http://www.tomkinson.org #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License. #
# If you modify this, let me know for fun. =) #
########################################################################

if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
    die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
//get_lang($module_name);

$pagetitle = "- $module_name";

include("header.php");

global $prefix, $dbi, $sitename, $admin;

$HideViewReadOnly = 1;
$ThemeSel = get_theme();
$Last_New_Topics = 40;
$show .= "<tr>
<td height=\"25\" colspan=\"6\" align=\"center\" class=\"catbottom\" background=\"\">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";
$result = sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result, $dbi ) )

{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
list( $auth_view, $auth_read ) = sql_fetch_row( $result1, $dbi );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}

if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}

if( $skip_display == 0 )
{
$Count_Topics += 1;

$result2 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'", $dbi);
list($username, $user_id)=sql_fetch_row($result2, $dbi);
$avtor=$username;
$sifra=$user_id;

$result3 = sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%d/%m/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);

$result4 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result4, $dbi);

$viewlast .="<tr>
<td height=\"30\" nowrap bgcolor=\"#FFFFFF\" class=\"row1\"><b>&nbsp;·&nbsp;</b></td>
<td width=\"100%\" bgcolor=\"#FFFFFF\" class=\"row1\">&nbsp;<a href=\"forums.html?file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row2\"><b>$topic_replies</b></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row3\"><a href=\"forums.html?file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap bgcolor=\"#FFFFFF\" class=\"row3\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
<a href=\"forums.html?file=profile&mode=viewprofile&u=$user_id\">$username</a>&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"></a></td>
</tr>";
}

if( $Last_New_Topics == $Count_Topics ) { break 1; }

}

$mycontent .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"$bgcolor1\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" nowrap background=\"\" class=\"thcornerl\"><font color=\"#006699\"><strong>Latest Discussion Topics</strong></font></th>
<th width=\"50\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
<th width=\"100\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong>&nbsp;Author&nbsp;</strong></font></th>
<th width=\"50\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong>&nbsp;Views&nbsp;</strong></font></th>
<th align=\"center\" nowrap background=\"\" class=\"thcornerr\"><font color=\"#006699\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
</tr>";
echo "$mycontent";
echo "$viewlast";
echo "$show";
include("footer.php");
 

?>


You'll have to do some cleaning up like with long titles it really stretches but this is a start.

_________________
[b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©