These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * $Id: syndication.php v 1.0 18 Dec 2011 Yerres Exp $ |
||
4 | * Module: Lexikon - glossary module |
||
5 | * Version: v 1.00 |
||
6 | * Release Date: 18 Dec 2011 |
||
7 | * Author: Yerres |
||
8 | * Licence: GNU |
||
9 | */ |
||
10 | if (function_exists('mb_http_output')) { |
||
11 | mb_http_output('pass'); |
||
12 | } |
||
13 | include("../../mainfile.php"); |
||
14 | include_once( XOOPS_ROOT_PATH . "/header.php" ); |
||
15 | include_once XOOPS_ROOT_PATH.'/class/template.php'; |
||
16 | $tpl = new XoopsTpl(); |
||
17 | $tpl ->xoops_setCaching(0); |
||
18 | |||
19 | Global $xoopsUser, $xoopsDB, $xoopsConfig, $xoopsModuleConfig; |
||
20 | $myts = & MyTextSanitizer :: getInstance(); |
||
21 | |||
22 | //if ( !is_object( $xoopsUser ) && $xoopsModuleConfig['contentsyndication'] == 0 ) { |
||
0 ignored issues
–
show
|
|||
23 | if ( $xoopsModuleConfig['contentsyndication'] == 0 ) { |
||
24 | echo " " . _NOPERM . " "; |
||
25 | exit(); |
||
26 | } |
||
27 | //permissions |
||
28 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
29 | $gperm_handler =& xoops_gethandler('groupperm'); |
||
30 | $module_id = $xoopsModule->getVar('mid'); |
||
31 | |||
32 | $tpl->assign('multicats', intval($xoopsModuleConfig['multicats'])); |
||
33 | |||
34 | // To display the syndicated definition |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
47% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
35 | //list($numrows) = $xoopsDB -> fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB -> prefix("lxentries")." WHERE offline = '0' AND submit = '0' AND request = '0'")); |
||
36 | $resultX = $xoopsDB -> query( " |
||
37 | SELECT a.entryID, a.categoryID, a.term, a.offline, b.* |
||
38 | FROM " . $xoopsDB -> prefix( "lxentries" ) . " a, ".$xoopsDB->prefix('group_permission')." b |
||
39 | WHERE a.categoryID = b.gperm_itemid AND b.gperm_modid = $module_id AND b.gperm_name = \"lexikon_view\" AND b.gperm_groupid = $groups[0] AND offline = '0' AND submit = '0' "); |
||
40 | $numrows = $xoopsDB -> getRowsNum ( $resultX ); |
||
41 | |||
42 | View Code Duplication | if ( $numrows > 1) { |
|
43 | $numrows = $numrows-1; |
||
44 | mt_srand((double)microtime()*1000000); |
||
45 | $entrynumber = mt_rand(0, $numrows); |
||
46 | } else { |
||
47 | $entrynumber = 0; |
||
48 | } |
||
49 | //$resultZ = $xoopsDB -> query ( " SELECT entryID, categoryID, term, definition FROM ".$xoopsDB->prefix("lxentries")." WHERE offline = '0' AND submit = '0' AND request = '0' LIMIT $entrynumber, 1"); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
55% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
50 | $resultZ = $xoopsDB -> query("SELECT a.entryID, a.categoryID, a.term, a.definition, a.offline, b.* FROM " . $xoopsDB->prefix("lxentries") . " a, ".$xoopsDB->prefix('group_permission')." b WHERE a.categoryID = b.gperm_itemid AND b.gperm_modid = $module_id AND b.gperm_name = \"lexikon_view\" AND b.gperm_groupid = $groups[0] AND a.datesub < ".time()." AND a.offline = '0' AND a.submit = '0' LIMIT $entrynumber, 1"); |
||
51 | |||
52 | $zerotest = $xoopsDB -> getRowsNum( $resultZ ); |
||
53 | if ( $zerotest != 0 ) { |
||
54 | while ( $myrow = $xoopsDB->fetchArray($resultZ)) { |
||
55 | $syndication = array(); |
||
56 | $syndication['id'] = $myrow['entryID']; |
||
57 | $syndication['term'] = ucfirst($myrow['term']); |
||
58 | View Code Duplication | if ( !XOOPS_USE_MULTIBYTES ) { |
|
59 | $syndication['definition'] = $myts -> displayTarea(xoops_substr ( $myrow['definition'], 0, ( $xoopsModuleConfig['rndlength'] -3 ) ) , 1, 1, 1, 1, 1); |
||
60 | // note: if the definitions are too long try : $xoopsModuleConfig['rndlength'] -20 ) and decrease font-size:x-small below ... |
||
61 | } |
||
62 | View Code Duplication | if ( $xoopsModuleConfig['multicats'] == 1 ) { |
|
63 | $syndication['catID'] = $myrow['categoryID']; |
||
64 | $resultY = $xoopsDB -> query ("SELECT categoryID, name FROM ". $xoopsDB -> prefix ("lxcategories") . " WHERE categoryID = ".$myrow['categoryID']." "); |
||
65 | list ( $categoryID, $name ) = $xoopsDB -> fetchRow ( $resultY ); |
||
66 | $syndication['categoryname'] = $myts -> displayTarea ($name); |
||
67 | } |
||
68 | } |
||
69 | $tpl -> assign ( 'syndication', $syndication ); |
||
70 | } |
||
71 | $tpl -> assign ( 'lang_modulename', $xoopsModule->name() ); |
||
72 | $tpl -> assign ( 'lang_moduledirname', $xoopsModule->getVar('dirname') ); |
||
73 | $tpl -> assign ( 'lang_sitename', $xoopsConfig['sitename'] ); |
||
74 | |||
75 | $tpl->display( "db:lx_syndication.html" ) ; |
||
76 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.