| 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 partners from the xoopspartners module (tested with version 1.1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | function b_marquee_xoopspartners($limit, $dateFormat, $itemsSize) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     $block    = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     $myts     = MyTextSanitizer::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     $arrayIds = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     $arrayIds = xoopspartners_random($limit); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     foreach ($arrayIds as $id) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         $result = $xoopsDB->query('SELECT id, url, image, title FROM ' . $xoopsDB->prefix('partners') . " WHERE id=$id"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         list($id, $url, $image, $title) = $xoopsDB->fetchrow($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $origtitle = $title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $title     = $myts->htmlSpecialChars($title); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         if ($itemsSize > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             $title = $myts->htmlSpecialChars(substr($origtitle, 0, 19)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             $title = $myts->htmlSpecialChars($origtitle); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $block[] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             'date'     => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             'category' => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             'author'   => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |             'title'    => $title, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |             'link'     => "<a href='" . XOOPS_URL . '/modules/xoopspartners/vpartner.php?id=' . $id . "'>" . $title . '</a>' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     return $block; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  * @param        $numberPartners | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  * @param bool   $random | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  * @param string $orden | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  * @param string $desc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  * @return array | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 68 |  |  |  */ | 
            
                                                        
            
                                    
            
            
                | 69 |  |  | function xoopspartners_random($numberPartners, $random = true, $orden = '', $desc = '') | 
            
                                                        
            
                                    
            
            
                | 70 |  |  | { | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |     global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |     $PartnersId  = array(); | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |     $ArrayReturn = array(); | 
            
                                                        
            
                                    
            
            
                | 74 |  |  |     $numrows     = 0; | 
            
                                                        
            
                                    
            
            
                | 75 |  |  |     if ($random) { | 
            
                                                        
            
                                    
            
            
                | 76 |  |  |         $result  = $xoopsDB->query('SELECT id FROM ' . $xoopsDB->prefix('partners') . ' WHERE status = 1'); | 
            
                                                        
            
                                    
            
            
                | 77 |  |  |         $numrows = $xoopsDB->getRowsNum($result); | 
            
                                                        
            
                                    
            
            
                | 78 |  |  |     } else { | 
            
                                                        
            
                                    
            
            
                | 79 |  |  |         $result = $xoopsDB->query('SELECT id FROM ' . $xoopsDB->prefix('partners') . ' Where status = 1 ORDER BY ' . $orden . ' ' . $desc, $numberPartners); | 
            
                                                        
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 81 |  |  |     while ($ret = $xoopsDB->fetchArray($result)) { | 
            
                                                        
            
                                    
            
            
                | 82 |  |  |         $PartnersId[] = $ret['id']; | 
            
                                                        
            
                                    
            
            
                | 83 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 84 |  |  |     if (($numrows <= $numberPartners) || (!$random)) { | 
            
                                                        
            
                                    
            
            
                | 85 |  |  |         return $PartnersId; | 
            
                                                        
            
                                    
            
            
                | 86 |  |  |         //        exit(); | 
            
                                                        
            
                                    
            
            
                | 87 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 88 |  |  |     $numberTotal  = 0; | 
            
                                                        
            
                                    
            
            
                | 89 |  |  |     $totalPartner = count($PartnersId) - 1; | 
            
                                                        
            
                                    
            
            
                | 90 |  |  |     while ($numberPartners > $numberTotal) { | 
            
                                                        
            
                                    
            
            
                | 91 |  |  |         $RandomPart = mt_rand(0, $totalPartner); | 
            
                                                        
            
                                    
            
            
                | 92 |  |  |         if (!in_array($PartnersId[$RandomPart], $ArrayReturn)) { | 
            
                                                        
            
                                    
            
            
                | 93 |  |  |             $ArrayReturn[] = $PartnersId[$RandomPart]; | 
            
                                                        
            
                                    
            
            
                | 94 |  |  |             ++$numberTotal; | 
            
                                                        
            
                                    
            
            
                | 95 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 96 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 98 |  |  |     return $ArrayReturn; | 
            
                                                        
            
                                    
            
            
                | 99 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 100 |  |  |  | 
            
                        
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.