Ok, done by myself, i wanna share the result because it might be useful.
Found on php.net this function:
/**
* Examples
* return seconds in a year:
* echo time_to_seconds (0, 0, 0, 1);
*
* get a time() value from 30 days ago:
* echo time() - time_to_seconds (0, 0, 30);
*/
function time_to_seconds ($minutes, $hours=NULL, $days=NULL, $years=NULL) {
$seconds = 0;
$seconds += $minutes * 60;
if ($hours != NULL) $seconds += $hours * 3600;
if ($days != NULL) $seconds += $days * 86400;
if ($years != NULL) $seconds += $years * 31536000;
return $seconds;
}
so i applyed it to the /modules/xfsection/blocks/xfs_top.php
making it looks this way:
if ( !function_exists('xfs_checkAccess') )
{
include_once XOOPS_ROOT_PATH."/modules/xfsection/include/xfs_groupaccess.php";
}
function time_to_seconds ($minutes, $hours=NULL, $days=NULL, $years=NULL) {
$seconds = 0;
$seconds += $minutes * 60;
if ($hours != NULL) $seconds += $hours * 3600;
if ($days != NULL) $seconds += $days * 86400;
if ($years != NULL) $seconds += $years * 31536000;
return $seconds;
}
function b_xfs_top_show($options) { // *** change this ***
global $xoopsDB;
$myts =& MyTextSanitizer::getInstance();
$block = array();
// *** change this ***
// $sql = "SELECT articleid, title, published, expired, counter, groupid FROM ".$xoopsDB->prefix("wfs_article")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND noshowart = 0 AND offline = 0 ORDER BY ".$options[0]." DESC";
$sql = "SELECT articleid, title, published, expired, counter, groupid FROM ".$xoopsDB->prefix("xfs_article")." WHERE published < ".time()." AND published > ".(time() - time_to_seconds (0, 0, 30))." AND (expired = 0 OR expired > ".time().") AND noshowart = 0 AND offline = 0 ORDER BY ".$options[0]." DESC";
$result = $xoopsDB->query($sql,$options[1],0);
while ( $myrow = $xoopsDB->fetchArray($result) ) {
// for avoiding to collide with WFsection.
// if(checkAccess($myrow["groupid"])) {
if(xfs_checkAccess($myrow["groupid"])) {
$wfs = array();
$title = $myts->makeTboxData4Show($myrow["title"]);
if ( !XOOPS_USE_MULTIBYTES ) {
if (strlen($myrow['title']) >= $options[2]) {
$title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."...";
}
}
$wfs['title'] = $title;
$wfs['id'] = $myrow['articleid'];
if ( $options[0] == "published" ) {
$wfs['top'] = formatTimestamp($myrow['published'],"s");
} elseif ( $options[0] == "counter" ) {
$wfs['top'] = $myrow['counter'];
}
$block['top'][] = $wfs;
}
}
return $block;
}
function b_xfs_top_edit($options) { // *** change this ***
// rename WFS to XFS
$form = ""._MB_XFS_ORDER." ;
$form .= "n";
$form .= "n";
$form .= "n";
// rename WFS to XFS
$form .= " "._MB_XFS_DISP." .$options[1]."' /> "._MB_XFS_ARTCLS."";
$form .= "
"._MB_XFS_CHARS." .$options[2]."' /> "._MB_XFS_LENGTH."";
return $form;
}
?>
After including the function the key is:
AND published > ".(time() - time_to_seconds (0, 0, 30))."
so the result is that he pulls off db the top articles of the last 30 days.
Cheers