Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.02.02 Distro
Author Message
oprime2001
Worker
Worker


Joined: Jun 04, 2004
Posts: 119
Location: Chicago IL USA

PostPosted: Wed Sep 20, 2006 9:29 am Reply with quote

I'm using RavenNuke76 v2.02.02 Distro, and my programmed articles do not show up sometimes. I looked into the code and there is this section
Code:
          $num = $db->sql_numrows($db->sql_query("SELECT sid FROM ".$prefix."_stories WHERE title='$title'"));

          if ($num == 0) {
           $db->sql_query("DELETE FROM ".$prefix."_autonews WHERE anid='$anid'");
              $db->sql_query("INSERT INTO ".$prefix."_stories VALUES (NULL, '$catid2', '$aid2', '$title', '$time2', '$hometext', '$bodytext', '0', '0', '$topic2', '$informant2', '$notes', '$ihome2', '$alanguage2', '$acomm2', '0', '0', '0', '0', '$associated2')");
            $db->sql_freeresult($result2);
within mainfile.php around line 1272. This segment seems to check if there is already an article with the same title, and if there is NO article with the same title as the programmed article, only then post the programmed article.

My problem is that sometimes I/my website users do reuse article titles. Is there any obious potential harm if I disable that check -- knowing that I am allowing duplicate titles for different articles (SIDs)?

_________________
Image 
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6383

PostPosted: Wed Sep 20, 2006 1:40 pm Reply with quote

Sounds good to me...

_________________
I google, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
oprime2001
PostPosted: Wed Sep 20, 2006 2:09 pm Reply with quote

Additional code changes in automated_news() function within mainfile.php:
Code:
function automated_news() {

    global $prefix, $multilingual, $currentlang, $db;
// oprime2001      if ($multilingual == 1) {
// oprime2001      $querylang = "WHERE (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
// oprime2001    } else {
// oprime2001      $querylang = "";
// oprime2001      }
    $today = getdate();
    $day = $today['mday'];
    if ($day < 10) {
   $day = "0$day";
    }
    $month = $today['mon'];
    if ($month < 10) {
   $month = "0$month";
    }
    $year = $today['year'];
    $hour = $today['hours'];
    $min = $today['minutes'];
    $sec = "00";
// oprime2001   $result = $db->sql_query("SELECT anid, time FROM ".$prefix."_autonews $querylang");
    $result = $db->sql_query("SELECT anid, time FROM ".$prefix."_autonews");
    while (list($anid, $time) = $db->sql_fetchrow($result)) {
   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, $date);
   if (($date[1] <= $year) AND ($date[2] <= $month) AND ($date[3] <= $day)) {
       if (($date[4] < $hour) AND ($date[5] >= $min) OR ($date[4] <= $hour) AND ($date[5] <= $min)) {
      $result2 = $db->sql_query("SELECT * FROM ".$prefix."_autonews WHERE anid='$anid'");
      while ($row2 = $db->sql_fetchrow($result2)) {
          $title = stripslashes(FixQuotes(check_html($row2['title'], "nohtml")));
          $hometext = stripslashes(FixQuotes($row2['hometext']));
          $bodytext = stripslashes(FixQuotes($row2['bodytext']));
          $notes = stripslashes(FixQuotes($row2['notes']));
          $catid2 = intval($row2['catid']);
          $aid2 = $row2['aid'];
          $time2 = $row2['time'];
          $topic2 = $row2['topic'];
          $informant2 = $row2['informant'];
          $ihome2 = intval($row2['ihome']);
          $alanguage2 = $row2['alanguage'];
          $acomm2 = intval($row2['acomm']);
          $associated2 = $row2['associated'];
// START - oprime2001 - removed check for duplicate titles
//          $num = $db->sql_numrows($db->sql_query("SELECT sid FROM ".$prefix."_stories WHERE title='$title'"));
//          if ($num == 0) {
           $db->sql_query("DELETE FROM ".$prefix."_autonews WHERE anid='$anid'");
              $db->sql_query("INSERT INTO ".$prefix."_stories VALUES (NULL, '$catid2', '$aid2', '$title', '$time2', '$hometext', '$bodytext', '0', '0', '$topic2', '$informant2', '$notes', '$ihome2', '$alanguage2', '$acomm2', '0', '0', '0', '0', '$associated2')");
            $db->sql_freeresult($result2);
//          }
// END - oprime2001 - removed check for duplicate titles
      }
       }
   }
    }
   $db->sql_freeresult($result);
}

I also commented out a check for multilingual site and the subsequent query using the check for multilingual site. With the multilingual check and query, there were still some programmed articles that remained stuck in the queue (nuke_autonews table). Once commented-out, these "stuck" programmed articles were posted.

I don't quite understand why removing the multilingual-related lines resolved my issues with programmed articles; my multilingual flag is even set to 0 on the nuke_config table. It might have been coincidence, but I tried/refreshed the News module multiple times 1-5 minutes after the programmed time of the articles. Nevertheless, some of the programmed articles remained stuck in the queue while others posted. Once commented out, all the "stuck" programmed articles posted on the next page refresh of the News module

My changes have been commented with oprime2001.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.02.02 Distro

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 ©