/**
* 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;
}
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." <select name='options[]'>";
$form .= "<option value='published'";
if ( $options[0] == "published" ) {
$form .= " selected='selected'";
}
// rename WFS to XFS
$form .= ">"._MB_XFS_DATE."</option>n";
$form .= "<option value='counter'";
if($options[0] == "counter"){
$form .= " selected='selected'";
}
// rename WFS to XFS
$form .= ">"._MB_XFS_HITS."</option>n";
$form .= "</select>n";
// rename WFS to XFS
$form .= " "._MB_XFS_DISP." <input type='text' name='options[]' value='".$options[1]."' /> "._MB_XFS_ARTCLS."";
$form .= " <br>"._MB_XFS_CHARS." <input type='text' name='options[]' value='".$options[2]."' /> "._MB_XFS_LENGTH."";
return $form;
}
?>
AND published > ".(time() - time_to_seconds (0, 0, 30))."
$sql = "SELECT articleid, title, published, expired, counter, groupid FROM ".$xoopsDB->prefix("xfs_article")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND noshowart = 0 AND offline = 0 ORDER BY ".$options[0]." DESC";
WarDick wrote:
Hi Samuels,
First let me say thank you for such a great implementation. I have just installed it into my news module and all works well except for the problem described above. I can not insert an image though the image manager. I followed your advice.
Quote:For imagemanager you must change the imagemanager template with the one I've included on the package.
The second problem is because I had an error overriding a method.It will be fixed on new version.
Buf I still can not insert an image. It works great with the insert image button.
I guess the next item is a request rather than a bug report. To make the preview work with the theme style sheet. Such as image padding, margins and etc.
//KOIVI WYSIWYG CLASS
include XOOPS_ROOT_PATH . "/class/wysiwyg/formwysiwygtextarea.php";
//Koivi Add
//$sform->addElement(new XoopsFormDhtmlTextArea(_WFS_MAINTEXT, 'message', $message, 15, 60), true);
$sform->addElement(new XoopsFormWysiwygTextArea( _WFS_MAINTEXT, 'message', $message, '100%', '400px',''), true);
ob_start();
$sw = new SPAW_Wysiwyg( 'message', $message, 'en', 'full', 'default', '99%', '600px' );
$sw -> show();
$sform -> addElement( new XoopsFormLabel( _WFS_MAINTEXT, ob_get_contents() ) );
ob_end_clean();
include_once XOOPS_ROOT_PATH.'/class/xoopscomments.php';
$spaw_root = XOOPS_ROOT_PATH . '/modules/spaw/';
include_once $spaw_root . 'spaw_control.class.php';
if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) $wfsConfig['wysiwygeditor'] = '0';
if ($wfsConfig['wysiwygeditor'] == '1') {
html_editor('maintext');
// checks browser compatibility with the control
function checkBrowser() {
global $HTTP_SERVER_VARS;
$browser = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
// check if msie
if (eregi("MSIE[^;]*",$browser,$msie)) {
// get version
if (eregi("[0-9]+.[0-9]+",$msie[0],$version)) {
// check version
if ((float)$version[0]>=5.5) {
// finally check if it's not opera impersonating ie
if (!eregi("opera",$browser)) {
return true;
}
}
}
}
return false;
}
if (checkBrowser())
{
$wfsConfig['wysiwygeditor'] = '1';
}
else
{
$wfsConfig['wysiwygeditor'] = '0';
}
if ($wfsConfig['wysiwygeditor'] == '1') {
//html_editor('maintext');
$sw = new SPAW_Wysiwyg( 'maintext', $this->maintext, 'en', 'full', 'default', '98%', '550px' );
$sw -> show();
$spaw_root = XOOPS_ROOT_PATH . '/modules/spaw/';
include_once $spaw_root . 'spaw_control.class.php';
// checks browser compatibility with the control
function checkBrowser() {
global $HTTP_SERVER_VARS;
$browser = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
// check if msie
if (eregi("MSIE[^;]*",$browser,$msie)) {
// get version
if (eregi("[0-9]+.[0-9]+",$msie[0],$version)) {
// check version
if ((float)$version[0]>=5.5) {
// finally check if it's not opera impersonating ie
if (!eregi("opera",$browser)) {
return true;
}
}
}
}
return false;
}
if (checkBrowser()) {
// use spaw
ob_start();
$sw = new SPAW_Wysiwyg( 'catdescription', $xt->catdescription("E"), 'en', 'full', 'default', '99%', '600px' );
$sw -> show();
$sform -> addElement( new XoopsFormLabel( _WFS_CATEGORYHEAD, ob_get_contents() ) );
ob_end_clean();
} else {
// do anything else
$sform->addElement(new XoopsFormDhtmlTextArea(_WFS_CATEGORYHEAD, 'catdescription', $xt->catdescription("E"), 10, 60), false);
}
//html_editor('maintext');
$sw = new SPAW_Wysiwyg( 'maintext', $this->maintext, 'en', 'full', 'default', '98%', '550px' );
$sw -> show();