| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * **************************************************************************** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Marquee - MODULE FOR XOOPS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * You may not change or alter any portion of this comment or credits | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * of supporting developers from this source code or any supporting source code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * which is considered copyrighted (c) material of the original comment or credit authors. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @copyright         Hervé Thouzard (http://www.herve-thouzard.com) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @license           http://www.fsf.org/copyleft/gpl.html GNU public license | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @package           marquee | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @author            Hervé Thouzard (http://www.herve-thouzard.com) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * Version : $Id: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * **************************************************************************** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @param $limit | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @param $dateFormat | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * @param $itemsSize | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 29 |  |  | // Script to list recent articles from wfsection 1 & 2 | 
            
                                                        
            
                                    
            
            
                | 30 |  |  | function b_marquee_wfsection($limit, $dateFormat, $itemsSize) | 
            
                                                        
            
                                    
            
            
                | 31 |  |  | { | 
            
                                                        
            
                                    
            
            
                | 32 |  |  |     include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; | 
            
                                                        
            
                                    
            
            
                | 33 |  |  |     $block = array(); | 
            
                                                        
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 35 |  |  |     $myts              = MyTextSanitizer::getInstance(); | 
            
                                                        
            
                                    
            
            
                | 36 |  |  |     $moduleHandler    = xoops_getHandler('module'); | 
            
                                                        
            
                                    
            
            
                | 37 |  |  |     $wfsection         = $moduleHandler->getByDirname('wfsection'); | 
            
                                                        
            
                                    
            
            
                | 38 |  |  |     $wfsectionVersion = (int)$wfsection->getInfo('version'); | 
            
                                                        
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 40 |  |  |     if ($wfsectionVersion >= 2) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 41 |  |  |     } else { // wfsection 1 | 
            
                                                        
            
                                    
            
            
                | 42 |  |  |         include_once XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; | 
            
                                                        
            
                                    
            
            
                | 43 |  |  |         global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 44 |  |  |         $sql    = 'SELECT articleid, title, published, expired, counter, groupid, uid 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 published DESC'; | 
            
                                                        
            
                                    
            
            
                | 45 |  |  |         $result = $xoopsDB->query($sql, $limit, 0); | 
            
                                                        
            
                                                                    
                                                                                                        
            
            
                | 46 |  | View Code Duplication |         while ($myrow = $xoopsDB->fetchArray($result)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 47 |  |  |             if (checkAccess($myrow['groupid'])) { | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |                 $wfs   = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 49 |  |  |                 $title = $myts->htmlSpecialChars($myrow['title']); | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |                 if (!XOOPS_USE_MULTIBYTES) { | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |                     if ($itemsSize > 0) { | 
            
                                                        
            
                                    
            
            
                | 52 |  |  |                         $title = $myts->htmlSpecialChars(substr($myrow['title'], 0, $itemsSize)); | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |                     } else { | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |                         $title = $myts->htmlSpecialChars($myrow['title']); | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |                     } | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |                 } | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |                 $block[] = array( | 
            
                                                        
            
                                    
            
            
                | 58 |  |  |                     'date'     => formatTimestamp($myrow['published'], $dateFormat), | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |                     'category' => '', | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |                     'author'   => XoopsUser::getUnameFromId($myrow['uid']), | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |                     'title'    => $title, | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |                     'link'     => "<a href='" . XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $myrow['articleid'] . "'>" . $title . '</a>' | 
            
                                                        
            
                                    
            
            
                | 63 |  |  |                 ); | 
            
                                                        
            
                                    
            
            
                | 64 |  |  |             } | 
            
                                                        
            
                                    
            
            
                | 65 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 66 |  |  |     } // wfsection 1 ou 2 ? | 
            
                                                        
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 68 |  |  |     return $block; | 
            
                                                        
            
                                    
            
            
                | 69 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 70 |  |  |  | 
            
                        
This check looks for the bodies of
ifstatements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
ifbodies can be removed. If you have an empty if but statements in theelsebranch, consider inverting the condition.could be turned into
This is much more concise to read.