51
JCash
News 1.71 : Archive block never displayed :(
  • 2011/5/19 23:46

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


I can't display Archive block with Xoops 2.5.1a and News 1.71 (cloned version and renamed news) :(

Anyone has already noticed this bug ?

Here the code, news_archives.php (sorry for long post) :
<?php
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.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, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
if (!defined('XOOPS_ROOT_PATH')) {
    die(
'XOOPS root path not defined');
}

/**
 * Solves issue when upgrading xoops version
 * Paths not set and block would not work
*/
if (!defined('NW2_MODULE_PATH')) {
    
define("NW2_SUBPREFIX""nw2");
    
define("NW2_MODULE_DIR_NAME""news");
    
define("NW2_MODULE_PATH"XOOPS_ROOT_PATH "/modules/" NW2_MODULE_DIR_NAME);
    
define("NW2_MODULE_URL"XOOPS_URL "/modules/" NW2_MODULE_DIR_NAME);
    
define("NW2_UPLOADS_NEWS_PATH"XOOPS_ROOT_PATH "/uploads/" NW2_MODULE_DIR_NAME);
    
define("NW2_TOPICS_FILES_PATH"XOOPS_ROOT_PATH "/uploads/" NW2_MODULE_DIR_NAME "/topics");
    
define("NW2_ATTACHED_FILES_PATH"XOOPS_ROOT_PATH "/uploads/" NW2_MODULE_DIR_NAME "/attached");
    
define("NW2_TOPICS_FILES_URL"XOOPS_URL "/uploads/" NW2_MODULE_DIR_NAME "/topics");
    
define("NW2_ATTACHED_FILES_URL"XOOPS_URL "/uploads/" NW2_MODULE_DIR_NAME "/attached");
}

include_once 
NW2_MODULE_PATH '/class/class.newsstory.php';

/**
 * Display archives
 * @param array $options :
 *         0 = sort order (0=older first, 1=newer first)
 *         1 = Starting date, year
 *         2 = Starting date, month
 *         3 = Ending date, year
 *         4 = Ending date, month
 *         5 = until today ?
 */
function nw2_b_news_archives_show($options)
{
    global 
$xoopsDB$xoopsConfig;
    include_once 
NW2_MODULE_PATH '/class/class.newsstory.php';
    include_once 
NW2_MODULE_PATH '/include/functions.php';
    include_once 
XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/calendar.php';
    if (
file_exists(NW2_MODULE_PATH '/language/'.$xoopsConfig['language'].'/main.php')) {
        include_once 
NW2_MODULE_PATH '/language/'.$xoopsConfig['language'].'/main.php';
    } else {
        include_once 
NW2_MODULE_PATH '/language/english/main.php';
    }
    
    
$months_arr = array(=> _CAL_JANUARY=> _CAL_FEBRUARY=> _CAL_MARCH=> _CAL_APRIL=> _CAL_MAY=> _CAL_JUNE=> _CAL_JULY=> _CAL_AUGUST=> _CAL_SEPTEMBER10 => _CAL_OCTOBER11 => _CAL_NOVEMBER12 => _CAL_DECEMBER);
    
$block = array();
    
$sort_order $options[0] == 'ASC' 'DESC';
    
$starting_date mktime(0,0,0,intval($options[2]), 1intval($options[1]));
    if(
intval($options[5])!=1) {
        
$ending_date mktime(23,59,59,intval($options[4]), 28intval($options[3]));
    } else {
        
$ending_date time();
    }
    
$sql "SELECT distinct(FROM_UNIXTIME(published,'%Y-%m')) as published FROM ".$xoopsDB->prefix('nw2_stories').' WHERE published>='.$starting_date .' AND published<='.$ending_date.' ORDER BY published '.$sort_order;
    
$result $xoopsDB->query($sql);
    if (!
$result) {
        return 
'';
    }
    while (
$myrow $xoopsDB->fetchArray($result)) {
        
$year intval(substr($myrow['published'],0,4));
        
$month intval(substr($myrow['published'],5,2));
        
$formated_month $months_arr[$month];
        
$block['archives'][] = array('month' => $month'year' => $year'formated_month' => $formated_month);
    }
    
//DNPROSSI ADDED
    
$block['newsmodule_url']= NW2_MODULE_URL;
    return 
$block;
}


function 
nw2_b_news_archives_edit($options)
{
    global 
$xoopsDB;
    
$syear $smonth $eyear $emonth $older $recent 0;
    
$selsyear $selsmonth $seleyear $selemonth 0;
    
$form '';

    
$selsyear $options[1];
    
$selsmonth $options[2];
    
$seleyear $options[3];
    
$selemonth $options[4];

    
$tmpstory = new nw2_NewsStory;
    
$tmpstory->GetOlderRecentnews($older$recent);    // We are searching for the module's older and more recent article's date

    // Min and max value for the two dates selectors
    // We are going to use the older news for the starting date
    
$syear date('Y'$older);
    
$smonth date('n'$older);
    
$eyear date('Y'$recent);
    
$emonth date('n'$recent);
    
// Verify parameters
    
if($selsyear == &&  $selsmonth == 0) {
        
$selsyear $syear;
        
$selsmonth $smonth;
    }
    if(
$seleyear == && $selemonth == 0) {
        
$seleyear $eyear;
        
$selemonth $emonth;
    }

    
// Sort order *************************************************************
    // (0=older first, 1=newer first)
    
$form .= '<b>'._MB_NW2_ORDER."</b>&nbsp;<select name='options[]'>";
    
$form .= "<option value='0'";
    if ( 
$options[0] == ) {
        
$form .= " selected='selected'";
    }
    
$form .= '>'._MB_NW2_OLDER_FIRST."</option>n";
    
$form .= "<option value='1'";
    if(
$options[0] == 1){
        
$form .= " selected='selected'";
    }
    
$form .= '>'._MB_NW2_RECENT_FIRST.'</option>';
    
$form .= "</select>n";


    
// Starting and ending dates **********************************************
    
$form .= '<br /><br /><b>'._MB_NW2_STARTING_DATE.'</b><br />';
    
$form .= _MB_NW2_CAL_YEAR."&nbsp;<select name='options[]'>";
    for(
$i=$syear$i<=$eyear$i++) {
        
$selected = ($i == $selsyear) ? "selected='selected'" '';
        
$form .= "<option value='".$i."'".$selected.'>'.$i.'</option>';
    }
    
$form .= '</select>&nbsp;'._MB_NW2_CAL_MONTH."&nbsp;<select name='options[]'>";
    for(
$i=1$i<=12$i++) {
        
$selected = ($i == $selsmonth) ? "selected='selected'" '';
        
$form .= "<option value='".$i."'".$selected.'>'.$i.'</option>';
    }
    
$form .= '</select>';

    
$form .= '<br /><br /><b>'._MB_NW2_ENDING_DATE.'</b><br />';
    
$form .= _MB_NW2_CAL_YEAR."&nbsp;<select name='options[]'>";
    for(
$i=$syear$i<=$eyear$i++) {
        
$selected = ($i == $seleyear) ? "selected='selected'" '';
        
$form .= "<option value='".$i."'".$selected.'>'.$i.'</option>';
    }
    
$form .= '</select>&nbsp;'._MB_NW2_CAL_MONTH."&nbsp;<select name='options[]'>";
    for(
$i=1$i<=12$i++) {
        
$selected = ($i == $selemonth) ? "selected='selected'" '';
        
$form .= "<option value='".$i."'".$selected.'>'.$i.'</option>';
    }
    
$form .= '</select>';

    
// Or until today *********************************************************
    
$form .= '<br />';
    
$checked $options[5] == " checked='checked'" '';
    
$form .= "<input type='checkbox' value='1' name='options[]'".$checked.'>';
    
$form .= ' <b>'._MB_NW2_UNTIL_TODAY.'</b>';


    return 
$form;
}


function 
nw2_b_news_archives_onthefly($options)
{
    
$options explode('|',$options);
    
$block = & nw2_b_news_archives_show($options);

    
$tpl = new XoopsTpl();
    
$tpl->assign('block'$block);
    
$tpl->display('db:nw2_news_block_archives.html');
}

?>


Archive block works with News 1.67 and Xoops 2.5.1a... but in my case, it is too late to downgrade :(

Any solution ?
Thanks



52
JCash
Re: New module problem ?
  • 2011/5/7 20:16

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


Go to options module and change your Rich Text editor...



53
JCash
Re: Teamwork on xnews and solve problems
  • 2011/3/14 15:27

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


[bug]

tpl nw_news_article.html, line 32 : </script> tag is alone



54
JCash
Re: ?> shown on all pages
  • 2011/3/12 13:31

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


Mainfile ?
See edition date column ?
Change to the default theme ?



55
JCash
Re: extgallery options to add?
  • 2011/3/9 18:44

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


Looks interesting, thx :)

It would be nice if we there was a form to edit photo. For moment we can update his description and his weight but ... it's not possible to change image.

If yes, we will able to use extgallery to create catalogs :)



56
JCash
Re: Wysiwyg editors don't run
  • 2011/2/22 22:52

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


Update News 1.63 to News 1.66 or xNews 1.71




TopTop
« 1 ... 3 4 5 (6)



Login

Who's Online

219 user(s) are online (150 user(s) are browsing Support Forums)


Members: 0


Guests: 219


more...

Donat-O-Meter

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

Latest GitHub Commits