function b_marquee_xfsection($limit, $dateformat, $itemssize) { $block = array(); global $xoopsDB; if (!function_exists('xfblock_checkAccess')) { include_once XOOPS_ROOT_PATH . "/modules/xfsection/include/xfblock_groupaccess.php"; } $myts =& MyTextSanitizer::getInstance(); $sql = "SELECT articleid, title, published, expired, counter, groupid, uid 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 published DESC"; $result = $xoopsDB->query($sql, $limit, 0); while ($myrow = $xoopsDB->fetchArray($result)) { if (xfblock_checkAccess($myrow["groupid"])) { $wfs = array(); $title = $myts->htmlSpecialChars($myrow["title"]); if (!XOOPS_USE_MULTIBYTES) { if ($itemssize > 0) { $title = $myts->htmlSpecialChars(substr($myrow['title'], 0, $itemssize - 1)); } else { $title = $myts->htmlSpecialChars($myrow['title']); } } $block[] = array('date' => formatTimestamp($myrow['published'], $dateformat), 'category' => '', 'author' => XoopsUser::getUnameFromId($myrow['uid']), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/xfsection/article.php?articleid=' . $myrow['articleid'] . "'>" . $title . '</a>'); } } return $block; }
function b_xfs_menu($options) { // *** change this *** global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); $block = array(); // *** change this *** // $result = $xoopsDB->query("SELECT id, title, pid, groupid FROM ".$xoopsDB->prefix("wfs_category")." ORDER BY title ASC"); $result = $xoopsDB->query("SELECT id, title, pid, groupid FROM ".$xoopsDB->prefix("xfs_category")." ORDER BY title ASC"); while ( $myrow = $xoopsDB->fetchArray($result) ) { // for avoiding to collide with WFsection. // if(checkAccess($myrow["groupid"])) { // xfs -> xfblock // if(xfs_checkAccess($myrow["groupid"])) { if(xfblock_checkAccess($myrow["groupid"])) { $wfsmenu = array(); $ctitle = $myts->makeTboxData4Show($myrow["title"]); $pid = $myts->makeTboxData4Show($myrow["pid"]); $id = $myts->makeTboxData4Show($myrow["id"]); if ($pid == '0') { $wfsmenu['ctitle'] = $ctitle; $wfsmenu['id'] = $id; $block['menus'][] = $wfsmenu; } } } return $block; }
function b_xfs_artmenu($options) { // *** change this *** global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); $block = array(); // *** change this *** // $sql = "SELECT articleid, title, groupid FROM ".$xoopsDB->prefix("wfs_article")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND offline = 0 AND noshowart = 1 ORDER BY weight ASC"; $sql = "SELECT articleid, title, groupid FROM ".$xoopsDB->prefix("xfs_article")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND offline = 0 AND noshowart = 1 ORDER BY weight ASC"; $result = $xoopsDB->query($sql); while ( $myrow = $xoopsDB->fetchArray($result) ) { // for avoiding to collide with WFsection. // if(checkAccess($myrow["groupid"])) { // xfs -> xfblock // if(xfs_checkAccess($myrow["groupid"])) { if(xfblock_checkAccess($myrow["groupid"])) { $wfsmenu2 = array(); $nstitle = $myts->makeTboxData4Show($myrow["title"]); $nsid = $myts->makeTboxData4Show($myrow["articleid"]); $wfsmenu2['nstitle'] = $nstitle; $wfsmenu2['nsid'] = $nsid; $block['nsmenu'][] = $wfsmenu2; } } return $block; }
function b_xfs_down_show($options) { // *** change this *** global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); $block = array(); // *** change this *** // $sql = "SELECT fileid, filerealname, filetext ,articleid, fileshowname, date, ext, minetype, downloadname, counter, filedescript, groupid FROM ".$xoopsDB->prefix("wfs_files")." ORDER BY ".$options[0]." DESC"; $sql = "SELECT fileid, filerealname, filetext ,articleid, fileshowname, date, ext, minetype, downloadname, counter, filedescript, groupid FROM ".$xoopsDB->prefix("xfs_files")." 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"])) { // xfs -> xfblock // if(xfs_checkAccess($myrow["groupid"])) { if(xfblock_checkAccess($myrow["groupid"])) { $wfsd = array(); $title = $myts->makeTboxData4Show($myrow["fileshowname"]); if ( !XOOPS_USE_MULTIBYTES ) { if (strlen($myrow['fileshowname']) >= $options[2]) { $title = $myts->makeTboxData4Show(substr($myrow['fileshowname'],0,($options[2] -1)))."..."; } } $wfsd['titledown'] = $title; $wfsd['iddown'] = $myrow['articleid']; if ( $options[0] == "date" ) { $wfsd['date'] = formatTimestamp($myrow['date'],"s"); } elseif ( $options[0] == "counter" ) { $wfsd['date'] = $myrow['counter']; } $block['download'][] = $wfsd; } } return $block; }
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 > 0 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"])) { // xfs -> xfblock // if(xfs_checkAccess($myrow["groupid"])) { if(xfblock_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_bigstory_show() { // *** change this *** global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); $block = array(); $tdate = mktime(0,0,0,date("n"),date("j"),date("Y")); // *** change this *** // $result = $xoopsDB->query("SELECT articleid, title, summary, groupid FROM ".$xoopsDB->prefix("wfs_article")." WHERE published > ".$tdate." AND published < ".time()." AND (expired > ".time()." OR expired = 0) AND noshowart = 0 AND offline = 0 ORDER BY counter DESC",1,0); $result = $xoopsDB->query("SELECT articleid, title, summary, groupid FROM ".$xoopsDB->prefix("xfs_article")." WHERE published > ".$tdate." AND published < ".time()." AND (expired > ".time()." OR expired = 0) AND noshowart = 0 AND offline = 0 ORDER BY counter DESC",1,0); list($farticleid, $ftitle, $fsummary, $fgroupid) = $xoopsDB->fetchRow($result); if ( !$farticleid && !$ftitle) { // rename WFS to XFS $block['message'] = _MB_XFS_NOTYET; } else { // for avoiding to collide with WFsection. // if (checkAccess($fgroupid)) { // xfs -> xfblock // if (xfs_checkAccess($fgroupid)) { if (xfblock_checkAccess($fgroupid)) { // rename WFS to XFS $block['message'] = _MB_XFS_TMRSI; $block['story_title'] = $myts->makeTboxData4Show($ftitle); $block['story_summary'] = $myts->makeTboxData4Show($fsummary); $block['story_id'] = $farticleid; } } return $block; }
/** * Outputs an html selectbox * * Outputs an html selectbox containing the whole tree ($root=0) or a specified sub-tree. * If $recurse is false, the box will only contain direct children of the specified <i>$root</i>. * * @param string $title Database field to use for elements title * @param string $order Database field to use for ordering elements * @param integer $root Element to use as root (0 for all the tree) * @param boolean $recurse * @param integer $preset_id Originally selected element * @param boolean $showroot Show root element as first one * @param string $sel_name HTML select element name * @param string $onchange Value of HTML onchange attribute * @author Kazumi Ono * @author Catzwolf * @author Skalpa Keo */ function makeMyRootedSelBox($title, $order="", $root=0, $recurse=false, $preset_id=0, $showroot=0, $sel_name="", $onchange="") { global $xoopsUser, $xoopsModule; $admincheck = true; if (empty($sel_name)) { $sel_name = $this->id; } $myts =& MyTextSanitizer::getInstance(); echo "<select name='".$sel_name."'"; if ( $onchange != "" ) { echo ' onchange="' . $onchange . '"'; } echo ">\n"; // Get root category name and check for access if ($root == 0) { $roottitle = '-----------'; $rootaccess = 1; } else { $rootres = $this->db->query("SELECT $title, groupid, editaccess FROM {$this->table} WHERE {$this->id}=$root"); if (list($roottitle, $rootaccess) = $this->db->fetchRow($rootres)) { // change function name checkAccess to xfs_checkAccess // $rootaccess = checkAccess($rootaccess); // xfs -> xfblock // $rootaccess = xfs_checkAccess($rootaccess); $rootaccess = xfblock_checkAccess($rootaccess); } else { $rootaccess = 0; } } if ($rootaccess) { if ($showroot) { echo "<option value='$root'>$roottitle</option>\n"; } // bug? I feel this line is meaningless. // $xoopsModule = XoopsModule::getByDirname("wfsection"); $sql = "SELECT {$this->id}, $title, groupid, editaccess FROM {$this->table} WHERE {$this->pid}=$root"; if ( $order != "" ) { $sql .= " ORDER BY $order"; } $result = $this->db->query($sql); while ( list($catid, $name, $groupid, $editaccess) = $this->db->fetchRow($result) ) { // bug? an unnecessary code // echo $string; // change function name checkAccess to xfs_checkAccess // if (checkAccess($groupid)) { // xfs -> xfblock // if (xfs_checkAccess($groupid)) { if (xfblock_checkAccess($groupid)) { $sel = ($catid == $preset_id) ? " selected='selected'" : ""; if (($root != 0) && $showroot) { $name = "-- $name"; } echo "<option value='$catid'$sel>$name</option>\n"; if ($recurse) { $arr = $this->getChildTreeArray($catid, $order); foreach ( $arr as $option ) { $option['prefix'] = str_replace(".","--",$option['prefix']); $catpath = $option['prefix']." ".$myts->makeTboxData4Show($option[$title]); if (($root != 0) && $showroot) { $catpath = "--$catpath"; } $sel = ($option[$this->id] == $preset_id) ? " selected='selected'" : ""; echo "<option value='{$option[$this->id]}'$sel>$catpath</option>\n"; } } } } } echo "</select>\n"; }