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
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Fri Sep 10, 2004 10:47 pm Reply with quote

I think I have resolved the mystery Smile I had noticed that Bill's Old Articles block was working so I got to snooping around in his code and tried a few things and saw that this works for me. This is v6.9 nuke, but I don't think much has changed. This should also work for NextGEN. In block-Old_Articles.php find this code
Code:
if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }

if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
and change it to
Code:
if (!isset($cookie[4])) { $r_options .= ".html"; } 

if (isset($cookie[4])) { $r_options .= "-$cookie[4]"; }
if (isset($cookie[5])) { $r_options .= "-$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "-$cookie[6].html";}

Then find this code
Code:
    if($time2==$datetime2) {

        $boxstuff .= "<tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\" $total_text>$title</a> ($comments)</td></tr>\n";
    } else {
        if($a=="") {
           $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\" $total_text>$title</a> ($comments)</td></tr>\n";
          $time2 = $datetime2;
          $a = 1;
      } else {
         $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\" $total_text>$title</a> ($comments)</td></tr>\n";
         $time2 = $datetime2;
      }
    }
and change it to
Code:
    if($time2==$datetime2) {

        $boxstuff .= "<tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"article$sid$r_options\" $total_text>$title</a> ($comments)</td></tr>\n";
    } else {
        if($a=="") {
           $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"article$sid$r_options\" $total_text>$title</a> ($comments)</td></tr>\n";
          $time2 = $datetime2;
          $a = 1;
      } else {
          $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"article$sid$r_options\" $total_text>$title</a> ($comments)</td></tr>\n";
          $time2 = $datetime2;
      }
    }
 
View user's profile Send private message
64bitguy
The Mouse Is Extension Of Arm


Joined: Mar 06, 2004
Posts: 1159
Location: Sanbornton, NH USA

PostPosted: Sat Sep 11, 2004 6:18 am Reply with quote

Hi Raven!

Thanks for the great post. I wish I had this a couple of nights ago, as you know I've been going through all of my blocks and converting them for GoogleTap (which has been just a TON of fun... please detect the note of sarcasm!)

I only found issue with a single aspect of your code; the exclusion of the fix for the "Older Articles" button.

As for the original code included with Chatserv's 7.4 Patched 2.5, I found a bug that I have also corrected and displayed below. The problem was that (with your code) my site displayed comments next to each article as () without any numbers in the parenthesis.

In my original Chatserv patched 2.5 code, (for some reason) I didn't have either the comments, nor the (). After a review of my code I found this:

Code:
if ($articlecomm == 1) {

   $comments = "($comments)";
    } else {
   $comments = "";
    }


Obviously, that presented a problem, so I fixed it. To be honest, I never noticed the problem until you presented your solution above, which made the () show up without anything in them. That's when it jumped out at me.

I'm not sure that my version of this fix is any more or any less elegant than what you presented above (I know me, my version is probably less elegant), but please feel free to checkout my final version of code. The output (compared to your solution) looks identical now that both solutions are appropriately patched. I would like to know which way is the most condusive to performance and functionality.

Here's the code the way that I had re-written it.
Code:


<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* Patched by Steph http://64bit.us for GoogleTap on                    */
/* September 9, 2004 @ 2:24AM-EST                                       */
/* Comments fixed, all links tested & verified                          */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

if (eregi("block-Old_Articles.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.php");
    die();
}

global $locale, $oldnum, $storynum, $storyhome, $cookie, $categories, $cat, $prefix, $multilingual, $currentlang, $db, $new_topic, $user_news, $comments;

if ($multilingual == 1) {
    if ($categories == 1) {
       $querylang = "where catid='$cat' AND (alanguage='$currentlang' OR alanguage='')";
    } else {
       $querylang = "where (alanguage='$currentlang' OR alanguage='')";
   if ($new_topic != 0) {
       $querylang .= " AND topic='$new_topic'";
   }
    }
} else {
    if ($categories == 1) {
      $querylang = "where catid='$cat'";
    } else {
   $querylang = "";
   if ($new_topic != 0) {
       $querylang = "WHERE topic='$new_topic'";
   }
    }
}
if (isset($cookie[3]) AND $user_news == 1) {
    $storynum = $cookie[3];
} else {
    $storynum = $storyhome;
}
$boxstuff = "<table border=\"0\" width=\"100%\">";
$boxTitle = _PASTARTICLES;
$result = $db->sql_query("SELECT sid, title, time, comments FROM ".$prefix."_stories $querylang ORDER BY time DESC LIMIT $storynum, $oldnum");
$vari = 0;

$r_options = "";
if (!isset($cookie[4])) { $r_options .= ".html"; }
if (isset($cookie[4])) { $r_options .= "-$cookie[4]"; }
if (isset($cookie[5])) { $r_options .= "-$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "-$cookie[6].html"; }

while ($row = $db->sql_fetchrow($result)) {
    $sid = intval($row['sid']);
    $title = stripslashes($row['title']);
    $time = $row['time'];
    $comments = $row['comments'];
    $see = 1;
    setlocale(LC_TIME, $locale);
    ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime2);
    $datetime2 = strftime(""._DATESTRING2."", mktime($datetime2[4],$datetime2[5],$datetime2[6],$datetime2[2],$datetime2[3],$datetime2[1]));
    $datetime2 = ucfirst($datetime2);
    if ($comments <> 0) {
   $comments = "$comments";
    } else {
   $comments = "0";
    }
    if($time2==$datetime2) {
        $boxstuff .= "<tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"article$sid$r_options\">$title</a> ($comments)</td></tr>\n";
    } else {
        if($a=="") {
           $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"article$sid$r_options\">$title</a> ($comments)</td></tr>\n";
       $time2 = $datetime2;
       $a = 1;
   } else {
       $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"article$sid$r_options\">$title</a> ($comments)</td></tr>\n";
       $time2 = $datetime2;
   }
    }
    $vari++;
    if ($vari==$oldnum) {
   if (isset($cookie[3])) {
       $storynum = $cookie[3];
   } else {
       $storynum = $storyhome;
   }
   $min = $oldnum + $storynum;
   $dummy = 1;
    }
}

if ($dummy == 1 AND is_active(Stories_Archive)) {
    $boxstuff .= "</table><br><a href=\"archive.html\"><center><b>Browse Entire Archive</b></center></a>\n";
} else {
    $boxstuff .= "</table>";
}

if ($see == 1) {
    $content = $boxstuff;
}

?>

_________________
Steph Benoit Only registered users can see links on this board! Get registered or login!
1CMS, 100% Section 508 and W3C XHTML/CSS Compliant (Truly) 
View user's profile Send private message Visit poster's website
Raven
PostPosted: Sat Sep 11, 2004 8:49 am Reply with quote

I did not have that problem because I don't use that code in v6.9 Smile
 
chatserv
Member Emeritus


Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Sun Sep 12, 2004 7:44 pm Reply with quote

Could you clarify what exactly happened when you had comments set to "" instead of "0" like you do now, by the way and for the record that is original code and not anything i came up with, i compared the 2.5 block for 7.4 to a "clean" block from 6.5 and the code is the same on both.
 
View user's profile Send private message Visit poster's website
Raven
PostPosted: Sun Sep 12, 2004 7:56 pm Reply with quote

Raven wrote:
I did not have that problem because I don't use that code in v6.9 Smile
For clarification, what I meant was that code is not in my block code so it never was a factor.
 
64bitguy
PostPosted: Mon Sep 13, 2004 5:50 am Reply with quote

chatserv wrote:
Could you clarify what exactly happened when you had comments set to "" instead of "0" like you do now, by the way and for the record that is original code and not anything i came up with, i compared the 2.5 block for 7.4 to a "clean" block from 6.5 and the code is the same on both.


Cool. I wouldn't know as I don't have any versions prior to 7.0, I was just pointing out that I based my fixes and re-write on the latest patched version (unaltered code distributed as part of the "Patched" series of solutions). It wasn't meant as a shot, but rather to point out that a large number of people probably have the code the way I have it.

I did notice that raven's (6.9?) version using "search more" archives is substantially different; in that it fails to have the monthly menu and values not showing up in the default destination; however, his "search more" results equate to the user being taken to an untapped destination of Only registered users can see links on this board! Get registered or login!

In my version of this code, the user is taken to a GoogleTapped destination of Only registered users can see links on this board! Get registered or login! which still has search capabilities, but also reveals the mothly "September", "August", "July", etc..list of Archived news articles for users to choose archived articles from, RATHER THAN the user being taken to the general "search.php" page (which is the case here) which does not show the actual article archives. It thought that strange.

Contrary to Raven thinking he does not use that code in his version of 6.9, this site DOES have a valid GoogleTapped destination page of Only registered users can see links on this board! Get registered or login! but for some reason Raven chooses not to employ it. I'm still not clear about why.

My version of this change would simply take users there instead of to his untapped search page (which also in my case and raven's is a valid GoogleTapped destination of Only registered users can see links on this board! Get registered or login! Again, I'm not sure why he chooses to leave it this way.

In any case, what I was trying to say was that raven's code fails to deliver a tapped address for this final block option.

Next, when I tried raven's code it equated to the output result being ().
When I added the zero, I got (0).

With $articlecomm set to ==1, the output result was that all comments came out BLANK in my version with no () at all, except those that had 1 comment. Those would come out (I'm assuming since I don't have any 1 comment articles) (1). Setting the value to <> 0 resulted (in my case) in the articles showed up as (1), (2), (3), etc... In fact if it weren't for raven's code being tested, I would have never known that each article actually shows a value of comments in the first place as all of mine had more than 1 comment and thus, with the old code were coming out blank (Nothing showed up, no (), no nothing!).

I'm assuming that since there is no field in $prefix_comments for tracking the number of posts (but rather it is a calculation based on the number of rows of comments for each article in the database) that is why I was getting a null value for the result (instead of a Zero) until I made that change.

Hope that's what you were looking for and thanks!
 
Raven
PostPosted: Mon Sep 13, 2004 6:11 am Reply with quote

64bitguy wrote:
Contrary to Raven thinking he does not use that code in his version of 6.9, this site DOES have a valid GoogleTapped destination page of Only registered users can see links on this board! Get registered or login! but for some reason Raven chooses not to employ it. I'm still not clear about why.
Contrary to what? All I was addressing was this piece of code
Code:
if ($articlecomm == 1) { 

   $comments = "($comments)";
    } else {
   $comments = "";
    }
My version of 6.9 Old Article's Block does not have that code in it. I do not understand what you are trying to imply/say.
 
64bitguy
PostPosted: Mon Sep 13, 2004 6:21 am Reply with quote

When I said,

Quote:
I only found issue with a single aspect of your code; the exclusion of the fix for the "Older Articles" button.


Your only response was:
Quote:
I did not have that problem because I don't use that code in v6.9


I thought that is what you were talking about. Not trying to imply or alude to any motives or anything... Again, I assumed you were saying what you said that because (at the time) I thought you were saying that 6.9 didn't utilize the archive.html feature. After all, until I checked it today, I had no idea and assumed that this might have been a feature introduced at 7.0. My familiarity with anything pre-7.0 is weak at best.
Cheers

I never saw your code having (or not having)
Code:
if ($articlecomm == 1) {

   $comments = "($comments)";
    } else {
   $comments = "";
    }

as I wasn't using (nor have I seen) your version of the rest of the code, but rather using just what I have, I had no idea that this section is what you were talking about. Again, that's why I pointed out that I was using 7.x patched 2.5.

Again, please note that you didn't publish all of your code, just your noted fixed sections so when you said what you said, I had no idea you were talking about the small section of above code, bur rather, I thought you were talking about your not including a GoogleTapped link solution to the search and/or archive sections. I figured you had some good reason for doing it this way, but were deciding to just keep that under your hat. Smile
 
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 ©