| @@ 13-60 (lines=48) @@ | ||
| 10 | ||
| 11 | if( ! defined( 'XOOPS_ROOT_PATH' ) ) die( 'XOOPS root path not defined' ) ; |
|
| 12 | ||
| 13 | function b_lxentries_new_show( $options ) { |
|
| 14 | global $xoopsDB,$xoopsUser; |
|
| 15 | ||
| 16 | $myts = & MyTextSanitizer :: getInstance(); |
|
| 17 | ||
| 18 | $module_handler = &xoops_gethandler('module'); |
|
| 19 | $lexikon = &$module_handler->getByDirname('lexikon'); |
|
| 20 | if (!isset($lxConfig)) { |
|
| 21 | $config_handler = &xoops_gethandler('config'); |
|
| 22 | $lxConfig = &$config_handler->getConfigsByCat(0, $lexikon->getVar('mid')); |
|
| 23 | } |
|
| 24 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 25 | $gperm_handler =& xoops_gethandler('groupperm'); |
|
| 26 | $module_id = $lexikon->getVar('mid'); |
|
| 27 | $allowed_cats = $gperm_handler->getItemIds("lexikon_view", $groups, $module_id); |
|
| 28 | $catids = implode(',', $allowed_cats); |
|
| 29 | $catperms = " AND categoryID IN ($catids) "; |
|
| 30 | ||
| 31 | $words = $xoopsDB -> query( "SELECT entryID FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE offline = '0' AND submit='0' AND request='0' AND block = '1' " ); |
|
| 32 | $totalwords = $xoopsDB -> getRowsNum( $words ); |
|
| 33 | ||
| 34 | $block = array(); |
|
| 35 | $block['marquee'] = ($options[2]==1)? 1:0; |
|
| 36 | $block['alternate'] = ($options[3]==1)? 1:0; |
|
| 37 | $block['showdate'] = ($options[4]==1)? 1:0; |
|
| 38 | $block['direction'] = $options[5]; |
|
| 39 | $block['speed'] = isset($options[6]) && $options[6] != '' ? $options[6] : '2'; |
|
| 40 | $block['bgcolor'] = isset($options[7]) && $options[7] != '' ? $options[7] : '#FFFFFF'; |
|
| 41 | ||
| 42 | $sql = "SELECT entryID, categoryID, term, datesub FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND offline = '0' ".$catperms." ORDER BY " . $options[0] . " DESC"; |
|
| 43 | $result = $xoopsDB->query ($sql, $options[1], 0); |
|
| 44 | ||
| 45 | if ( $totalwords > 0 ) // If there are definitions |
|
| 46 | { |
|
| 47 | while (list( $entryID, $categoryID, $term, $datesub ) = $xoopsDB->fetchRow($result)) { |
|
| 48 | $newentries = array(); |
|
| 49 | $linktext = ucfirst($myts -> htmlSpecialChars( $term )); |
|
| 50 | $newentries['dir'] = $lexikon->dirname(); |
|
| 51 | $newentries['linktext'] = $linktext; |
|
| 52 | $newentries['id'] = intval($entryID); |
|
| 53 | $newentries['date'] = formatTimestamp( $datesub, $lxConfig['dateformat'] ); |
|
| 54 | ||
| 55 | $block['newstuff'][] = $newentries; |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | return $block; |
|
| 60 | } |
|
| 61 | ||
| 62 | function b_lxentries_new_edit( $options ) { |
|
| 63 | $form = "<table width='100%' border='0' class='bg2'>"; |
|
| @@ 13-59 (lines=47) @@ | ||
| 10 | ||
| 11 | if( ! defined( 'XOOPS_ROOT_PATH' ) ) die( 'XOOPS root path not defined' ) ; |
|
| 12 | ||
| 13 | function b_lxentries_top_show( $options ) { |
|
| 14 | global $xoopsDB, $xoopsUser; |
|
| 15 | $myts = & MyTextSanitizer :: getInstance(); |
|
| 16 | ||
| 17 | $module_handler = &xoops_gethandler('module'); |
|
| 18 | $lexikon = &$module_handler->getByDirname('lexikon'); |
|
| 19 | if (!isset($lxConfig)) { |
|
| 20 | $config_handler = &xoops_gethandler('config'); |
|
| 21 | $lxConfig = &$config_handler->getConfigsByCat(0, $lexikon->getVar('mid')); |
|
| 22 | } |
|
| 23 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 24 | $gperm_handler =& xoops_gethandler('groupperm'); |
|
| 25 | $module_id = $lexikon->getVar('mid'); |
|
| 26 | $allowed_cats = $gperm_handler->getItemIds("lexikon_view", $groups, $module_id); |
|
| 27 | $catids = implode(',', $allowed_cats); |
|
| 28 | $catperms = " AND categoryID IN ($catids) "; |
|
| 29 | ||
| 30 | $words = $xoopsDB -> query( "SELECT entryID FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE offline = '0' AND submit='0' AND request='0' AND block = '1'"); |
|
| 31 | $totalwords = $xoopsDB -> getRowsNum( $words ); |
|
| 32 | ||
| 33 | $block = array(); |
|
| 34 | $block['marquee'] = ($options[2]==1)? 1:0; |
|
| 35 | $block['alternate'] = ($options[3]==1)? 1:0; |
|
| 36 | $block['showcounter'] = ($options[4]==1)? 1:0; |
|
| 37 | $block['direction'] = $options[5]; |
|
| 38 | $block['speed'] = isset($options[6]) && $options[6] != '' ? $options[6] : '2'; |
|
| 39 | $block['bgcolor'] = isset($options[7]) && $options[7] != '' ? $options[7] : '#FFFFFF'; |
|
| 40 | ||
| 41 | $sql = "SELECT entryID, categoryID, term, counter FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND offline = '0' ".$catperms." ORDER BY " . $options[0] . " DESC"; |
|
| 42 | $result = $xoopsDB -> query ($sql, $options[1], 0); |
|
| 43 | ||
| 44 | if ( $totalwords > 0 ) // If there are definitions |
|
| 45 | { |
|
| 46 | while (list( $entryID, $categoryID, $term, $counter ) = $xoopsDB->fetchRow($result)) { |
|
| 47 | $popentries = array(); |
|
| 48 | $linktext = $myts -> htmlSpecialChars( $term ); |
|
| 49 | $popentries['dir'] = $lexikon->dirname(); |
|
| 50 | $popentries['linktext'] = $linktext; |
|
| 51 | $popentries['id'] = intval($entryID); |
|
| 52 | $popentries['counter'] = intval( $counter ); |
|
| 53 | ||
| 54 | $block['popstuff'][] = $popentries; |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | return $block; |
|
| 59 | } |
|
| 60 | ||
| 61 | function b_lxentries_top_edit( $options ) { |
|
| 62 | $form = "<table width='100%' border='0' class='bg2'>"; |
|