1
martyras
News-block module
  • 2004/12/6 21:39

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Hi all.

I have used the News-block module (xoops2_block_news-block_1.zip available here at xoops.org). Everything goes as expected with one exception. It seems that this module doesn't look if a news post is expired or has set to be shown at a specific date and it shows them too. Anyone has a fix for that?

Tha code of the module it this:

// ######################################################################
// # News-block:                                                        #
// # v1  10/02/2004  FOR XOOPS v2                                       #
// # Ported by: Sylvain B. (sylvain@123rando.com)                       #
// # http://123rando.com                                                #
// #                                                                    #
// ######################################################################
// # PHP-Nuke                                                           #
// #====================================================================#
// # Copyright (c) 2003 - Francisco Burzi                               #
// # http://phpnuke.org/                                                #
// #====================================================================#
// # Paladin's block-Articles_Info for PHP-Nuke 6.5                     #
// #====================================================================#
// # Copyright (c) 2003 - Darren Poulton (paladin@intaleather.com.au)   #
// # http://paladin.intaleather.com.au/                                 #
// #====================================================================#
// # Use of this program is goverened by the terms of the GNU General   #
// # Public License (GPL - version 1 or 2) as published by the          #
// # Free Software Foundation (http://www.gnu.org/)                     #
// ######################################################################

function block_articles_info ($options) {

global 
$xoopsDB$xoopsUser;

        
$block = array();
        
$block['title'] = _MB_ARTICLE_INF;

        
$block['content'] = "odd">";
        
$block['content'] .= "";
        
$block['content'] .= "itemHead">";
        
$block['content'] .= ""._MB_LDCAT.""
;
        
$block['content'] .= ""._MB_LDTITLE.""
._MB_LDCOUNTER.""
;
        
//$block['content'] .= ""._MB_LDCOMTOTAL."";
        
        
        
$limit $options[0];
        
$color $bgcolor3;
        
$sql "SELECT t.topic_title, s.storyid, s.topicid, s.title, s.comments, s.counter
                        FROM "
.$xoopsDB->prefix("stories")." s, ".$xoopsDB->prefix("topics")." t
                        WHERE s.topicid=t.topic_id  
                        ORDER BY s.storyid DESC LIMIT 
$limit";
        
$result $xoopsDB->query($sql);
        while (list(
$cat$sid$topicid$title$comtotal$counter) = $xoopsDB->fetchRow($result)) {
        
$block['content'] .= "80" CLASS="odd">/modules/news/index.php?storytopic=$topicid">$cat";
        
$block['content'] .= "odd">/modules/news/article.php?storyid=$sid">$title";
        
$block['content'] .= "5" CLASS="odd">$counter";
        
//$block['content'] .= "$comtotal";
        
}
        
        
$block['content'] .= "";
        
//$block['content'] .= "
|[ "._MB_MORELINK." ]";
        //if ($options[1] == 1) {
        //$block['content'] .= "|[ "._MB_TOPICLINK." ]"; 
        //}
        //if ($options[2] == 1) { 
        //$block['content'] .= "|[ "._MB_ARCHIVELINK." ]";
        //}
        //if ($options[3] == 1) {
        //        if (empty($xoopsUser))
        //        {
        //            $block['content'] .= "";
        //        } else {
        //                $block['content'] .= "|[ "._MB_SUBMITLINK." ]";
        //        }
        //}
        //$block['content'] .= "|
";
        
$block['content'] .= "";
        return 
$block;
}



function 
b_articles_info_edit($options) {
        
$tabletag1='';
        
$tabletag2='';

        
$form "";
        
$form .= $tabletag1._MB_ARTICLE_DISPLAY.$tabletag2;
        
$form .= ".$options[0]."' size='4'> "._MB_ARTICLES."";
        
$form .= $tabletag1._MB_TOPICLINK.$tabletag2;
        
$form .= mk_chkbox($options,1);
        
$form .= $tabletag1._MB_ARCHIVELINK.$tabletag2;
        
$form .= mk_chkbox($options,2);
        
$form .= $tabletag1._MB_SUBMITLINK.$tabletag2;
        
$form .= mk_chkbox($options,3);
        
$form .= "";
        return 
$form;
}

function 
mk_chkbox($options$number) {
    
$chk   "";
    if (
$options[$number] == 0) {
        
$chk " checked='checked'";
    }
    
$chkbox"$number]' value='0'".$chk." /> "._NO."  ";
    
$chk   "";
    if (
$options[$number] == 1) {
        
$chk " checked='checked'";
    }
    
$chkbox .= "$number]' value='1'".$chk." /> "._YES."";
    RETURN 
$chkbox;
}
?>

2
martyras
Re: News-block module
  • 2004/12/7 16:23

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Hmm, maybe i was too drunk that night...

Anyway found it.

Just change this:
$sql "SELECT t.topic_title, s.storyid, s.topicid, s.title, s.comments, s.counter
                        FROM "
.$xoopsDB->prefix("stories")." s, ".$xoopsDB->prefix("topics")." t
                        WHERE s.topicid=t.topic_id  
                        ORDER BY s.storyid DESC LIMIT 
$limit";


Into this:
$sql "SELECT t.topic_title, s.storyid, s.topicid, s.title, s.comments, s.counter, s.published, s.expired
                        FROM "
.$xoopsDB->prefix("stories")." s, ".$xoopsDB->prefix("topics")." t
                        WHERE s.topicid=t.topic_id AND s.published < "
.time()." AND s.published > 0 AND (s.expired = 0 OR s.expired > ".time().")  
                        ORDER BY s.storyid DESC LIMIT 
$limit";


Happy xooping!

Login

Who's Online

326 user(s) are online (224 user(s) are browsing Support Forums)


Members: 0


Guests: 326


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits