Author |
Message |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Fri Nov 07, 2008 11:03 pm |
|
Well generally speaking there only a few general things you need do.
First is change the $dbi global (Your block my have more globals)
Code:
global $prefix, $dbi;
|
Code:
global $prefix, $db;
|
Then you need to remove the $dbi from all the quries.
Code:
$result = sql_query("select lid, title, hits, url from ".$prefix."_links_links order by linkratingsummary DESC limit 0,$mainlinkstoshow", $dbi)
|
Code:
$result = sql_query("select lid, title, hits, url from ".$prefix."_links_links order by linkratingsummary DESC limit 0,$mainlinkstoshow")
|
Finally you have to change the "query functions"
Code:
sql_query("select lid, ti .........
|
Code:
$db->sql_query("select lid, ti .........
|
You need to be carefull because all the functions are not like sql_query were you just append the $db->. For example with the old $dbi way you used sql_fetch_row(), but with the new way it has to be written $db->sql_fetchrow(). There are only a couple of functions that you will need to change, so just check in the newer blocks if you need help with one. Off the top of my head I can't think of the other functions that are different from old to new.
OLD:
sql_query($sql, $dbi)
sql_num_rows($sql, $dbi)
sql_fetch_row($sql, $dbi)
sql_fetch_array($sql, $dbi)
sql_fetch_object($sql, $dbi)
sql_free_result($sql, $dbi)
NEW:
$db->sql_query($sql)
$db->sql_numrows($sql)
$db->sql_fetchrow($sql)
$db->sql_fetchrow($sql)
$db->sql_fetchrow($sql)
$db->sql_freeresult($sql) |
Last edited by Palbin on Sat Feb 06, 2010 5:24 pm; edited 3 times in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Dawg
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/46907b8543f928e08c8d7.gif)
Joined: Nov 07, 2003
Posts: 928
|
Posted:
Sat Nov 08, 2008 1:02 am |
|
Excellent. Thank You Palbin! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
fkelly
Former Moderator in Good Standing
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY
|
Posted:
Sat Nov 08, 2008 7:37 am |
|
You might also want to turn database error reporting on (see documentation in rnconfig) when you are doing the conversion and monitor the dblog file. Of course, if the function never gets to the database layer it won't show up in the log but it could show any function calls that aren't correct.
Just remember to turn the error reporting off when you are done or else monitor the dblog regularly. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
CodyG
Life Cycles Becoming CPU Cycles
![](modules/Forums/images/avatars/186c8977515afcc3ed82a.jpg)
Joined: Jan 02, 2003
Posts: 714
Location: Vancouver Island
|
Posted:
Sat Nov 08, 2008 8:01 am |
|
Excellent. I was totally confuddled about sql_fetch_anything. Thank you. |
_________________ "We want to see if life is ubiquitous." D.Goldin |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
FireATST
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/1890b00a421a4615ecd23.jpg)
Joined: Jun 12, 2004
Posts: 654
Location: Ohio
|
Posted:
Sun Nov 09, 2008 7:39 am |
|
Ty Palbin!......my wife isn't to happy though....lol. I have spent a lot of time lately going through php files and code books. Thanks again for the nudge in the right direction..... ![Cheers](modules/Forums/images/smiles/cheers.gif) |
|
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
Site Admin
![](modules/Forums/images/avatars/41f0b40a419280935f3a0.gif)
Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Sun Nov 09, 2008 12:39 pm |
|
Nice reminder, Palbin, thanks! I'm pretty sure Chatserv wrote a similar tutorial a few years ago on nukefixes or nukeresources. |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Mar 18, 2007
Posts: 1242
|
Posted:
Tue Dec 23, 2008 5:50 pm |
|
Followed the instructions closely I think but my last 10 forums block, center down, in table format does not work. When activated, the left and right side blocks are missing altogether, here's the code:
Code:<?php
########################################################################
# PHP-Nuke Block: fiplain Center Forum Block v.2 #
# Made for PHP-Nuke 6.5 and up #
# #
# Made by mikem http://www.nukecops.com #
# This block is made only to match the fiplain Theme pack #
# #
########################################################################
# 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-fiplain-Forums.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $prefix, $db, $sitename, $admin;
$HideViewReadOnly = 1;
$Last_New_Topics = 10;
$show = " <tr><td bgcolor=\"#000000\" colspan=\"6\"></td></tr><tr>
<td height=\"28\" colspan=\"6\" align=\"center\" class=\"catbottom\" bgcolor=\"#F3F4C6\"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>";
$Count_Topics = 0;
$coloralt = 0;
$Topic_Buffer = "";
$result = $db->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" );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetch_row( $result ) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result1 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", );
list( $auth_view, $auth_read ) = $db->sql_fetch_row( $result1 );
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 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetch_row($result2);
$avtor=$username;
$sifra=$user_id;
$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetch_row($result3);
$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetch_row($result4);
if ($coloralt == 0) {
$viewlast .=" <tr>
<td height=\"30\" nowrap bgcolor=\"#C3C4FD\" class=\"row1\"><img src=\"themes/fiplain/forums/images/folder_new.gif\" border=\"0\" /></td>
<td width=\"100%\" bgcolor=\"#E8E97F\" class=\"row1\"> <a href=\"forums.html?file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" bgcolor=\"#9093FA\" class=\"row2\">$topic_replies</td>
<td align=\"center\" bgcolor=\"#E8E97F\" class=\"row3\"><a href=\"profile-.html$sifra\">$avtor</a></td>
<td align=\"center\" bgcolor=\"#9093FA\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap bgcolor=\"#E8E97F\" class=\"row3\"><font size=\"-2\"><i> $post_time </i></font><br>
<a href=\"profile-.html$user_id\">$username</a> <a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"themes/fiplain/forums/images/icon_minipost_new.gif\" border=\"0\" alt=\"Last Post\"></a></td>
</tr>";
$coloralt++;
} else {
$viewlast .=" <tr>
<td height=\"30\" nowrap bgcolor=\"#C3C4FD\" class=\"row1\"><img src=\"themes/fiplain/forums/images/folder_new.gif\" border=\"0\" /></td>
<td width=\"100%\" bgcolor=\"#F4F587\" class=\"row1\"> <a href=\"forums.html?file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" bgcolor=\"#9093FA\" class=\"row2\">$topic_replies</td>
<td align=\"center\" bgcolor=\"#F4F587\" class=\"row3\"><a href=\"profile-.html$sifra\">$avtor</a></td>
<td align=\"center\" bgcolor=\"#9093FA\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap bgcolor=\"#F4F587\" class=\"row3\"><font size=\"-2\"><i> $post_time </i></font><br>
<a href=\"profile-.html$user_id\">$username</a> <a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"themes/fiplain/forums/images/icon_minipost_new.gif\" border=\"0\" alt=\"Last Post\"></a></td>
</tr>";
$coloralt = 0;
}
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
$content .= "<table class=\"bodyline\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"#FFFFFF\"><table bgcolor=\"green\" width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" nowrap bgcolor=\"#9093FA\" class=\"thcornerl\"><font color=\"#000000\"><strong>Forum/Topic</strong></font></th>
<th width=\"50\" align=\"center\" nowrap bgcolor=\"#9093FA\" class=\"thtop\"><font color=\"#000000\"><strong> Replies </strong></font></th>
<th width=\"100\" align=\"center\" nowrap bgcolor=\"#9093FA\" class=\"thtop\"><font color=\"#000000\"><strong> Author </strong></font></th>
<th width=\"50\" align=\"center\" nowrap bgcolor=\"#9093FA\" class=\"thtop\"><font color=\"#000000\"><strong> Views </strong></font></th>
<th align=\"center\" nowrap bgcolor=\"#9093FA\" class=\"thcornerr\"><font color=\"#000000\"><strong> Last Post </strong></font></th>
</tr><tr><td bgcolor=\"#000000\" colspan=\"6\"></td></tr>";
$content .= "$viewlast";
$content .= "$show";
?>
|
What did I miss? It works just fine in the last RN version, running 2.3 now, default theme RavenIce.
Edit: I missed the fetch_row but changed it to fetchrow but didn't change anything.
Cheers, Jay |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Dec 23, 2008 7:26 pm |
|
I created the file "dblog". Is that it, no extension? Also did the permissions to 666 but I get nothing in the file when trying my top 10 forums file above.
Edit: Cripes, I placed it in the root instead of /rnlogs and there is already a dblog file there, just had to change the permissions.
And nothing shows up in the dblog when the broken block is activated.
Cheers, Jay |
Last edited by dad7732 on Wed Dec 24, 2008 8:11 am; edited 1 time in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
TAd
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/Garfield/Garfield_-_Garfield_2.gif)
Joined: Oct 11, 2004
Posts: 127
Location: Oregon, USA
|
Posted:
Wed Dec 24, 2008 3:57 am |
|
Thank you again! I finished up with my latest forum block, then I updated the Admin module "VersionNumber" which took all of 1-2 minutes!
Best regards,
TAd |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gotcha
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/blank.gif)
Joined: Mar 14, 2005
Posts: 91
|
Posted:
Wed Dec 24, 2008 9:30 am |
|
dad - change all instances of sql_fetch_row to sql_fetchrow and you should be good to go. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Dec 24, 2008 11:19 am |
|
gotcha - Note:
Edit: I missed the fetch_row but changed it to fetchrow but didn't change anything.
Already did that, no luck.
Cheers, Jay
EDIT: The block may be too "old" to modify. If that is the case I would like a compatible "Last Posts" block in table format, not like the "block-forums.php" that is included. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Dec 24, 2008 12:01 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
Site Admin
![](modules/Forums/images/avatars/125904890252d880f79f312.png)
Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Wed Dec 24, 2008 3:06 pm |
|
I think you can also doCode:
list( $auth_view, $auth_read ) = mysql_fetch_row( $result1 );
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Dec 24, 2008 3:50 pm |
|
yes, but this thread is about conversion
$db->sql_fetchrow($sql) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Dec 24, 2008 5:03 pm |
|
Nothing posted here is working to convert my particular block. Since when the block is activated, the right and left blocks are completely missing which leads me to believe that it's more serious than just DB conversion.
Cheers, Jay |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Dec 24, 2008 9:40 pm |
|
Give me a few days I'll fix it. Also I am going to split this into a new thread. It really shouldn't be in this one. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Dec 25, 2008 4:04 am |
|
Palbin wrote: | yes, but this thread is about conversion
$db->sql_fetchrow($sql) |
Yes but
Code:
$result1 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", );
list( $auth_view, $auth_read ) = mysql_fetch_row( $result1 );
| should still work as $result1 contains both a persistant connection and the query ![Wink](modules/Forums/images/smiles/icon_wink.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Dec 25, 2008 3:24 pm |
|
Does not work, I don't think that's where the problem lies as there is no display of the table and both right and left blocks do not show.
Cheers, Jay |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Dec 26, 2008 12:04 am |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Dec 26, 2008 7:44 am |
|
Thank you, that works just fine. We're back in business. I compared the new to the old and quite a bit of difference.
Cheers, best of the holidays. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Dec 26, 2008 10:20 am |
|
The big difference is that I added in some code to allow the block to consider the users time zone. The times in the block should match the times in the forums. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|