| 1 |  |  | <?php | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | use Xmf\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | require_once __DIR__ . '/common/traitversionchecks.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | require_once __DIR__ . '/common/traitserverstats.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | require_once __DIR__ . '/common/traitfilesmgmt.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * Class MyalbumUtil | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | class WfLinksUtility extends XoopsObject | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     use VersionChecks; //checkVerXoops, checkVerPhp Traits | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     use ServerStats; // getServerStats Trait | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     use FilesManagement; // Files Management Trait | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * wfs_gethandler() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * @param         $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * @param boolean $optional | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * @return bool | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     public static function getHandler($name, $optional = false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         global $handlers, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $name = strtolower(trim($name)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         if (!isset($handlers[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |             if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/class/class_' . $name . '.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |                 require_once $hnd_file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             $class = 'wfl' . ucfirst($name) . 'Handler'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             if (class_exists($class)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                 $handlers[$name] = new $class($GLOBALS['xoopsDB']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         if (!$optional && !isset($handlers[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             trigger_error('<div>Class <b>' . $class . '</b> does not exist.</div> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |                         <div>Handler Name: ' . $name, E_USER_ERROR) . '</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         return isset($handlers[$name]) ? $handlers[$name] : false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param int    $cid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @param string $permType | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @param bool   $redirect | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     public static function checkGroups($cid = 0, $permType = 'WFLinkCatPerm', $redirect = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         global $xoopsUser, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $groups       = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $gpermHandler = xoops_getHandler('groupperm'); | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 63 |  | View Code Duplication |         if (!$gpermHandler->checkRight($permType, $cid, $groups, $xoopsModule->getVar('mid'))) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             if ($redirect === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |                 return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |             redirect_header('index.php', 3, _NOPERM); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * @param int $lid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * @return array|bool|false | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     public static function getVoteDetails($lid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         $sql = 'SELECT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         COUNT(rating) AS rate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         MIN(rating) AS min_rate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         MAX(rating) AS max_rate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         AVG(rating) AS avg_rate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         COUNT(ratinguser) AS rating_user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         MAX(ratinguser) AS max_user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         MAX(title) AS max_title, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         MIN(title) AS min_title, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         sum(ratinguser = 0) AS null_ratinguser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         FROM ' . $xoopsDB->prefix('wflinks_votedata'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         if ($lid > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |             $sql .= " WHERE lid = $lid"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         if (!$result = $xoopsDB->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         $ret = $xoopsDB->fetchArray($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      * @param int $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |      * @return array|bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     public static function calculateVoteData($sel_id = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         $ret                  = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         $ret['useravgrating'] = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         $sql = 'SELECT rating FROM ' . $xoopsDB->prefix('wflinks_votedata'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         if ($sel_id != 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |             ' WHERE lid = ' . $sel_id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         if (!$result = $xoopsDB->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         $ret['uservotes'] = $xoopsDB->getRowsNum($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         while (list($rating) = $xoopsDB->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |             $ret['useravgrating'] += (int)$rating; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         if ($ret['useravgrating'] > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |             $ret['useravgrating'] = number_format($ret['useravgrating'] / $ret['uservotes'], 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |      * @param      $array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * @param null $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @param null $def | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * @param bool $strict | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * @param int  $lengthcheck | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @return array|int|mixed|null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     public static function cleanRequestVars($array, $name = null, $def = null, $strict = false, $lengthcheck = 15) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         // Sanitise $_request for further use.  This method gives more control and security. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |         // Method is more for functionality rather than beauty at the moment, will correct later. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         unset($array['usercookie'], $array['PHPSESSID']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         if (is_array($array) && $name === null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |             $globals = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             foreach (array_keys($array) as $k) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |                 $value = strip_tags(trim($array[$k])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |                 if ('' !== $value >= $lengthcheck) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |                     return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |                 } | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 154 |  | View Code Duplication |                 if (ctype_digit($value)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |                     $value = (int)$value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |                     if ($strict === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |                         $value = preg_replace('/\W/', '', trim($value)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |                     $value = strtolower((string)$value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |                 $globals[$k] = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |             return $globals; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         if (!array_key_exists($name, $array) || !isset($array[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             return $def; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         $value = strip_tags(trim($array[$name])); | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 172 |  | View Code Duplication |         if (ctype_digit($value)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             $value = (int)$value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |             if ($strict === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |                 $value = preg_replace('/\W/', '', trim($value)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |             $value = strtolower((string)$value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |         return $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     // toolbar() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     // @return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * @param int $cid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     public static function getToolbar($cid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         $toolbar = '[ '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         if (true === static::checkGroups($cid, 'WFLinkSubPerm')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |             $toolbar .= "<a href='submit.php?cid=" . $cid . "'>" . _MD_WFL_SUBMITLINK . '</a> | '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         $toolbar .= "<a href='newlist.php?newlinkshowdays=7'>" . _MD_WFL_LATESTLIST . "</a> | <a href='topten.php?list=hit'>" . _MD_WFL_POPULARITY . '</a>  ]'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         return $toolbar; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     // displayicons() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     // @param  $time | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     // @param integer $status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     // @param integer $counter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     // @return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |      * @param     $time | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * @param int $status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * @param int $counter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     public static function displayIcons($time, $status = 0, $counter = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |         global $xoopsModuleConfig, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |         $new = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         $pop = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |         $newdate = (time() - (86400 * (int)$xoopsModuleConfig['daysnew'])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |         $popdate = (time() - (86400 * (int)$xoopsModuleConfig['daysupdated'])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         if ($xoopsModuleConfig['displayicons'] != 3) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |             if ($newdate < $time) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |                 if ((int)$status > 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |                     if ($xoopsModuleConfig['displayicons'] == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |                         $new = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/update.png" alt="" align="top">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |                     if ($xoopsModuleConfig['displayicons'] == 2) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |                         $new = '<i>Updated!</i>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |                     if ($xoopsModuleConfig['displayicons'] == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |                         $new = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/new.png" alt="" align="top">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                     if ($xoopsModuleConfig['displayicons'] == 2) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |                         $new = '<i>New!</i>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |             if ($popdate > $time) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |                 if ($counter >= $xoopsModuleConfig['popular']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |                     if ($xoopsModuleConfig['displayicons'] == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |                         $pop = ' <img src ="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/popular.png" alt="" align="top">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |                     if ($xoopsModuleConfig['displayicons'] == 2) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |                         $pop = '<i>Popular!</i>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |         $icons = $new . ' ' . $pop; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         return $icons; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |     // updaterating() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |     // @param  $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     // @return updates rating data in itemtable for a given item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |      * @param $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |     public static function updateRating($sel_id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |         global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |         $query       = 'SELECT rating FROM ' . $xoopsDB->prefix('wflinks_votedata') . ' WHERE lid=' . $sel_id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |         $voteresult  = $xoopsDB->query($query); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |         $votesDB     = $xoopsDB->getRowsNum($voteresult); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |         $totalrating = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |         while (list($rating) = $xoopsDB->fetchRow($voteresult)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             $totalrating += $rating; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         $finalrating = $totalrating / $votesDB; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |         $finalrating = number_format($finalrating, 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         $sql         = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE lid = %u', $xoopsDB->prefix('wflinks_links'), $finalrating, $votesDB, $sel_id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         $xoopsDB->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |     // totalcategory() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |     // @param integer $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |     // @return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |      * @param int $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |      * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     public static function getTotalCategory($pid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |         global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |         $sql = 'SELECT cid FROM ' . $xoopsDB->prefix('wflinks_cat'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |         if ($pid > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |             $sql .= ' WHERE pid=0'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |         $result     = $xoopsDB->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         $catlisting = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |         while (list($cid) = $xoopsDB->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |             if (static::checkGroups($cid)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |                 ++$catlisting; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |         return $catlisting; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |     // static::getTotalItems() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |     // @param integer $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |     // @param integer $get_child | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |     // @param integer $return_sql | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |     // @return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |      * @param int $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |      * @param int $get_child | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |      * @param int $return_sql | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |     public static function getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |         global $xoopsDB, $mytree, $_check_array; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |         if ($sel_id > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |             $sql = 'SELECT DISTINCT a.lid, a.cid, published FROM ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |                    . $xoopsDB->prefix('wflinks_links') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |                    . ' a LEFT JOIN ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |                    . $xoopsDB->prefix('wflinks_altcat') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |                    . ' b ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |                    . 'ON b.lid=a.lid ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |                    . 'WHERE published > 0 AND published <= ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |                    . time() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |                    . ' AND (expired = 0 OR expired > ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |                    . time() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |                    . ') AND offline = 0 ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |                    . ' AND (b.cid=a.cid OR (a.cid=' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |                    . $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |                    . ' OR b.cid=' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |                    . $sel_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |                    . ')) '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |             $sql = 'SELECT lid, cid, published FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE offline = 0 AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |         if ($return_sql == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |             return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         $count          = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         $published_date = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |         $items  = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |         $result = $xoopsDB->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |         while (list($lid, $cid, $published) = $xoopsDB->fetchRow($result)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |             if (true === static::checkGroups()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |                 ++$count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |                 $published_date = ($published > $published_date) ? $published : $published_date; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |         $child_count = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |         if ($get_child == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |             $items = $mytree->getAllChildId($sel_id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |             foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |                 $query2 = 'SELECT DISTINCT a.lid, a.cid, published FROM ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |                           . $xoopsDB->prefix('wflinks_links') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |                           . ' a LEFT JOIN ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |                           . $xoopsDB->prefix('wflinks_altcat') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |                           . ' b ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |                           . 'ON b.lid=a.lid ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |                           . 'WHERE published > 0 AND published <= ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |                           . time() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |                           . ' AND (expired = 0 OR expired > ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |                           . time() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |                           . ') AND offline = 0 ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |                           . ' AND (b.cid=a.cid OR (a.cid=' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |                           . $item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |                           . ' OR b.cid=' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |                           . $item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |                           . ')) '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |                 $result2 = $xoopsDB->query($query2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |                 while (list($lid, $published) = $xoopsDB->fetchRow($result2)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |                     if ($published == 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |                         continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |                     $published_date = ($published > $published_date) ? $published : $published_date; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |                     ++$child_count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |         $info['count']     = $count + $child_count; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         $info['published'] = $published_date; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |         return $info; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |      * @param string $indeximage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |      * @param string $indexheading | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     public static function getImageHeader($indeximage = '', $indexheading = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         global $xoopsDB, $xoopsModuleConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         if ($indeximage == '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |             $result = $xoopsDB->query('SELECT indeximage, indexheading FROM ' . $xoopsDB->prefix('wflinks_indexpage')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |             list($indeximage, $indexheading) = $xoopsDB->fetchRow($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         $image = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |         if (!empty($indeximage)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |             $image = static::displayImage($indeximage, "'index.php'", $xoopsModuleConfig['mainimagedir'], $indexheading); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |         return $image; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |      * @param string $image | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |      * @param string $path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |      * @param string $imgsource | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |      * @param string $alttext | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |     public static function displayImage($image = '', $path = '', $imgsource = '', $alttext = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         global $xoopsConfig, $xoopsUser, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         $showimage = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |         // Check to see if link is given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         if ($path) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |             $showimage = '<a href=' . $path . '>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |         // checks to see if the file is valid else displays default blank image | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         if (!is_dir(XOOPS_ROOT_PATH . "/{$imgsource}/{$image}") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |             && file_exists(XOOPS_ROOT_PATH . "/{$imgsource}/{$image}")) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |             $showimage .= "<img src='" . XOOPS_URL . "/{$imgsource}/{$image}' border='0' alt='" . $alttext . "'></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |             if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |                 $showimage .= "<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/brokenimg.gif' alt='" . _MD_WFL_ISADMINNOTICE . "'></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                 $showimage .= "<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/blank.gif' alt='" . $alttext . "'></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         clearstatcache(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |         return $showimage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |     public static function getLetters() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |         global $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |         $letterchoice = '<div>' . _MD_WFL_BROWSETOTOPIC . '</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |         $letterchoice .= '[  '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |         $alphabet     = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |             '0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |             '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |             '2', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |             '3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |             '4', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |             '5', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |             '6', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |             '7', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |             '8', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |             '9', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |             'A', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |             'B', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |             'C', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |             'D', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |             'E', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |             'F', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |             'G', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |             'H', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |             'I', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |             'J', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |             'K', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |             'L', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |             'M', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |             'N', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |             'O', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |             'P', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |             'Q', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |             'R', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |             'S', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |             'T', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |             'U', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |             'V', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |             'W', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |             'X', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |             'Y', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |             'Z' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |         $num          = count($alphabet) - 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |         $counter      = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |         //    while (list(, $ltr) = each($alphabet)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |         foreach ($alphabet as $key => $ltr) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |             $letterchoice .= "<a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewcat.php?list=$ltr'>$ltr</a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |             if ($counter == round($num / 2)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                 $letterchoice .= ' ]<br>[ '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |             } elseif ($counter != $num) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |                 $letterchoice .= ' | '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |             ++$counter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |         $letterchoice .= ' ]'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |         return $letterchoice; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |      * @param $published | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |     public static function isNewImage($published) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |         global $xoopsModule, $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |         $oneday    = (time() - (86400 * 1)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |         $threedays = (time() - (86400 * 3)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |         $week      = (time() - (86400 * 7)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |         $path = 'modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |         if ($published > 0 && $published < $week) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |             $indicator['image']   = "$path/linkload4.gif"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |             $indicator['alttext'] = _MD_WFL_NEWLAST; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |         } elseif ($published >= $week && $published < $threedays) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |             $indicator['image']   = "$path/linkload3.gif"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |             $indicator['alttext'] = _MD_WFL_NEWTHIS; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |         } elseif ($published >= $threedays && $published < $oneday) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |             $indicator['image']   = "$path/linkload2.gif"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |             $indicator['alttext'] = _MD_WFL_THREE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |         } elseif ($published >= $oneday) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |             $indicator['image']   = "$path/linkload1.gif"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |             $indicator['alttext'] = _MD_WFL_TODAY; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |             $indicator['image']   = "$path/linkload.gif"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |             $indicator['alttext'] = _MD_WFL_NO_FILES; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |         return $indicator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |      * @param $haystack | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |      * @param $needle | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |     public static function searchString($haystack, $needle) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |         return substr($haystack, 0, strpos($haystack, $needle) + 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |      * @param string $header | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |      * @param string $menu | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |      * @param string $extra | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |      * @param int    $scount | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |      * @return null | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |     public static function getAdminMenu($header = '', $menu = '', $extra = '', $scount = 4) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |         global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |         $_named_url = xoops_getenv('PHP_SELF'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |         if ($_named_url) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |             $thispage = basename($_named_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |         if (file_exists(__DIR__ . '/../docs/' . $xoopsConfig['language'] . '/readme.html')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |             $docs = '<a href="../docs/' . $xoopsConfig['language'] . '/readme.html" target="_blank">' . _AM_WFL_DOCUMENTATION . '</a> |'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |         } elseif (file_exists(__DIR__ . '/../docs/english/readme.html')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |             $docs = '<a href="../docs/english/readme.html" target="_blank">' . _AM_WFL_DOCUMENTATION . '</a> |'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |             $docs = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |         $op = isset($_GET['op']) ? $op = '?op=' . $_GET['op'] : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |         echo "<h4 style='color: #2F5376;'>" . _AM_WFL_MODULE_NAME . '</h4>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |         echo " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |         <table width='100%' cellspacing='0' cellpadding='0' border='0' class='outer'>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |         <tr>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |         <td style='font-size: 10px; text-align: left; color: #2F5376; padding: 2px 6px; line-height: 18px;'>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |         <a href='../admin/index.php'>" . _AM_WFL_BINDEX . "</a> | \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |         <a href='../index.php'>" . _AM_WFL_GOMODULE . "</a> | \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |         <a href='../../system/admin.php?fct=preferences&op=showmod&mod=" . $xoopsModule->getVar('mid') . "'>" . _AM_WFL_PREFS . "</a> | \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |         <a href='../../system/admin.php?fct=modulesadmin&op=update&module=" . $xoopsModule->getVar('dirname') . "'>" . _AM_WFL_BUPDATE . "</a> | \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |         <a href='../admin/permissions.php'>" . _AM_WFL_BPERMISSIONS . "</a> | \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |         <a href='../admin/myblocksadmin.php'>" . _AM_WFL_BLOCKADMIN . "</a> | \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |         " . $docs . " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |         <a href='../admin/about.php'>" . _AM_WFL_ABOUT . "</a> \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |         </td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |         </tr>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |         </table><br>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |         "; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |         if (empty($menu)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |             // You can change this part to suit your own module. Defining this here will save you form having to do this each time. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |             $menu = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |                 _AM_WFL_INDEXPAGE      => 'indexpage.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |                 _AM_WFL_MCATEGORY      => 'category.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |                 _AM_WFL_MLINKS         => 'main.php?op=edit', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |                 _AM_WFL_MUPLOADS       => 'upload.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |                 _AM_WFL_MVOTEDATA      => 'votedata.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |                 _AM_WFL_MLISTPINGTIMES => 'main.php?op=pingtime', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |                 _AM_WFL_MCOMMENTS      => '../../system/admin.php?module=' . $xoopsModule->getVar('mid') . '&status=0&limit=100&fct=comments&selsubmit=Go', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |         if (!is_array($menu)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |             echo "<table width='100%' cellpadding= '2' cellspacing= '1' class='outer'>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |             echo "<tr><td class ='even' align ='center'><b>" . _AM_WFL_NOMENUITEMS . "</b></td></tr></table><br>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |         $oddnum = array(1 => '1', 3 => '3', 5 => '5', 7 => '7', 9 => '9', 11 => '11', 13 => '13'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |         // number of rows per menu | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |         $menurows = count($menu) / $scount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |         // total amount of rows to complete menu | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |         $menurow = ceil($menurows) * $scount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |         // actual number of menuitems per row | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |         $rowcount = $menurow / ceil($menurows); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |         $count    = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |         for ($i = count($menu); $i < $menurow; ++$i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |             $tempArray = array(1 => null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |             $menu      = array_merge($menu, $tempArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |             ++$count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |         // Sets up the width of each menu cell | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |         $width = 100 / $scount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |         $width = ceil($width); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |         $menucount = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |         $count     = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |         // Menu table output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |         echo "<table width='100%' cellpadding= '2' cellspacing= '1' class='outer'><tr>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |         // Check to see if $menu is and array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |         if (is_array($menu)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |             $classcounts = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |             $classcol[0] = 'even'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |             for ($i = 1; $i < $menurow; ++$i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |                 ++$classcounts; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |                 if ($classcounts >= $scount) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |                     if ($classcol[$i - 1] === 'odd') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |                         $classcol[$i] = ($classcol[$i - 1] === 'odd' && in_array($classcounts, $oddnum)) ? 'even' : 'odd'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |                         $classcol[$i] = ($classcol[$i - 1] === 'even' && in_array($classcounts, $oddnum)) ? 'odd' : 'even'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |                     $classcounts = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |                     $classcol[$i] = ($classcol[$i - 1] === 'even') ? 'odd' : 'even'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |             unset($classcounts); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |             foreach ($menu as $menutitle => $menulink) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |                 if ($thispage . $op == $menulink) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |                     $classcol[$count] = 'outer'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |                 echo "<td class='" . $classcol[$count] . "' class='txtcenter;' valign='middle' width='$width%'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |                 if (is_string($menulink)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |                     echo "<a href='" . $menulink . "'><small>" . $menutitle . '</small></a></td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |                     echo ' </td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |                 ++$menucount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |                 ++$count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |                 // Break menu cells to start a new row if $count > $scount | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |                 if ($menucount >= $scount) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |                     echo '</tr>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |                     $menucount = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |             echo '</table><br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |             unset($count, $menucount); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  |         // ###### Output warn messages for security ###### | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  |         if (is_dir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL1, XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  |         $_file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |         if (file_exists($_file)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL2, XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update.php')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  |         $path1 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['mainimagedir']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |         if (!is_dir($path1)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL3, $path1)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  |         if (!is_writable($path1)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL4, $path1)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |         $path1_t = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['mainimagedir'] . '/thumbs'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |         if (!is_dir($path1_t)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL3, $path1_t)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |         if (!is_writable($path1_t)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL4, $path1_t)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |         $path2 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['screenshots']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |         if (!is_dir($path2)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL3, $path2)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |         if (!is_writable($path2)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL4, $path2)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |         $path2_t = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['screenshots'] . '/thumbs'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |         if (!is_dir($path2_t)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL3, $path2_t)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |         if (!is_writable($path2_t)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL4, $path2_t)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |         $path3 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['catimage']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |         if (!is_dir($path3)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL3, $path3)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |         if (!is_writable($path3)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL4, $path3)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |         $path3_t = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['catimage'] . '/thumbs'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  |         if (!is_dir($path3_t)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL3, $path3_t)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  |         if (!is_writable($path3_t)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  |             xoops_error(sprintf(_AM_WFL_WARNINSTALL4, $path3_t)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |             echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  |         echo "<h3 style='color: #2F5376;'>" . $header . '</h3>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  |         if ($extra) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  |             echo "<div>$extra</div>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |      * @param $selected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |      * @param $dirarray | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  |      * @param $namearray | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |     public static function getDirSelectOption($selected, $dirarray, $namearray) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  |         echo "<select size='1' name='workd' onchange='location.href=\"upload.php?rootpath=\"+this.options[this.selectedIndex].value'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  |         echo "<option value=''>--------------------------------------</option>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  |         foreach ($namearray as $namearray => $workd) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  |             if ($workd === $selected) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 |  |  |                 $opt_selected = 'selected'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  |                 $opt_selected = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  |             echo "<option value='" . htmlspecialchars($namearray, ENT_QUOTES) . "' $opt_selected>" . $workd . '</option>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  |         echo '</select>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  |      * @param        $FILES | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  |      * @param string $uploaddir | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  |      * @param string $allowed_mimetypes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  |      * @param string $redirecturl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  |      * @param int    $num | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  |      * @param int    $redirect | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  |      * @param int    $usertype | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |      * @return array|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  |     public static function uploadFiles( | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  |         $FILES, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  |         $uploaddir = 'uploads', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  |         $allowed_mimetypes = '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |         $redirecturl = 'index.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |         $num = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |         $redirect = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |         $usertype = 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  |         global $FILES, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |         $down = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  |         require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/class/uploader.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |         if (empty($allowed_mimetypes)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  |             $allowed_mimetypes = wfl_getmime($FILES['userfile']['name'], $usertype); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  |         $upload_dir = XOOPS_ROOT_PATH . '/' . $uploaddir . '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  |         $maxfilesize   = $xoopsModuleConfig['maxfilesize']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  |         $maxfilewidth  = $xoopsModuleConfig['maximgwidth']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |         $maxfileheight = $xoopsModuleConfig['maximgheight']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  |         $uploader = new XoopsMediaUploader($upload_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  |         $uploader->noAdminSizeCheck(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  |         if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |             if (!$uploader->upload()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |                 $errors = $uploader->getErrors(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |                 redirect_header($redirecturl, 2, $errors); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |                 if ($redirect) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |                     redirect_header($redirecturl, 1, _AM_PDD_UPLOADFILE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |                     if (is_file($uploader->savedDestination)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  |                         $down['url']  = XOOPS_URL . '/' . $uploaddir . '/' . strtolower($uploader->savedFileName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |                         $down['size'] = filesize(XOOPS_ROOT_PATH . '/' . $uploaddir . '/' . strtolower($uploader->savedFileName)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  |                     return $down; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |             $errors = $uploader->getErrors(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |             redirect_header($redirecturl, 1, $errors); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |      * @param $forumid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  |     public static function getForum($forumid) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |         global $xoopsDB, $xoopsConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |         echo "<select name='forumid'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |         echo "<option value='0'>----------------------</option>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  |         if ($forumid < 4) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |             $result = $xoopsDB->query('SELECT forum_name, forum_id FROM ' . $xoopsDB->prefix('bb_forums') . ' ORDER BY forum_id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |             $result = $xoopsDB->query('SELECT forum_name, forum_id FROM ' . $xoopsDB->prefix('bbex_forums') . ' ORDER BY forum_id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |         } | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 872 |  | View Code Duplication |         while (list($forum_name, $forum_id) = $xoopsDB->fetchRow($result)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |             if ($forum_id == $forumid) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |                 $opt_selected = 'selected'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |                 $opt_selected = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |             echo "<option value='" . $forum_id . "' $opt_selected>" . $forum_name . '</option>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |         echo '</select></div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |         return $forumid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  |      * @param $heading | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  |     public static function getLinkListHeader($heading) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  |         echo " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  | <!--        <h4 style='font-weight: bold; color: #0A3760;'>" . $heading . "</h4>\n --> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |         <table width='100%' cellspacing='1' class='outer' style='font-size: smaller;' summary>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |         <tr>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |         <th class='txtcenter;'>" . _AM_WFL_MINDEX_ID . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |         <th style='text-align: left;'><b>" . _AM_WFL_MINDEX_TITLE . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |         <th style='text-align: left;'><b>" . _AM_WFL_CATTITLE . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |         <th class='txtcenter;'>" . _AM_WFL_MINDEX_POSTER . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  |         <th class='txtcenter;'>" . _AM_WFL_MINDEX_PUBLISH . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  |         <th class='txtcenter;'>" . _AM_WFL_MINDEX_EXPIRE . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |         <th class='txtcenter;'>" . _AM_WFL_MINDEX_ONLINE . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |         <th class='txtcenter;'>" . _AM_WFL_MINDEX_ACTION . "</th>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |         </tr>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |         "; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |      * @param $published | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |     public static function getLinkListBody($published) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |         global $wfmyts, $imagearray, $xoopsModuleConfig, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |         xoops_load('XoopsUserUtility'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |         $lid = $published['lid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  |         $cid = $published['cid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  |         $title     = "<a href='../singlelink.php?cid=" . $published['cid'] . '&lid=' . $published['lid'] . "'>" . $wfmyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |         $maintitle = urlencode($wfmyts->htmlSpecialChars(trim($published['title']))); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |         $cattitle  = static::getCategoryTitle($published['cid']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  |         $submitter = XoopsUserUtility::getUnameFromId($published['submitter']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |         $hwhoisurl = str_replace('http://', '', $published['url']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |         $submitted = formatTimestamp($published['date'], $xoopsModuleConfig['dateformat']); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  |         $publish   = ($published['published'] > 0) ? formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin']) : 'Not Published'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  |         $expires   = $published['expired'] ? formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin']) : _AM_WFL_MINDEX_NOTSET; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  |         //    if ( ( $published['published'] && $published['published'] < time() ) && $published['offline'] == 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  |         //        $published_status = $imagearray['online']; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |         //    } else { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  |         //        $published_status = ( $published['published'] == 0 ) ? "<a href='newlinks.php'>" . $imagearray['offline'] . "</a>" : $imagearray['offline']; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |         //    } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |         if ($published['offline'] == 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  |             && ($published['published'] && $published['published'] < time()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |                            && (($published['expired'] && $published['expired'] > time()) || $published['expired'] == 0)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  |             $published_status = $imagearray['online']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |         } elseif ($published['offline'] == 0 && ($published['expired'] && $published['expired'] < time())) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |             $published_status = $imagearray['expired']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |             $published_status = ($published['published'] == 0) ? "<a href='newlinks.php'>" . $imagearray['offline'] . '</a>' : $imagearray['offline']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  |         $icon = "<a href='main.php?op=edit&lid=" . $lid . "' title='" . _AM_WFL_ICO_EDIT . "'>" . $imagearray['editimg'] . '</a> '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |         $icon .= "<a href='main.php?op=delete&lid=" . $lid . "' title='" . _AM_WFL_ICO_DELETE . "'>" . $imagearray['deleteimg'] . '</a> '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  |         $icon .= "<a href='altcat.php?op=main&cid=" . $cid . '&lid=' . $lid . '&title=' . $wfmyts->htmlSpecialCharsStrip(trim($published['title'])) . "' title='" . _AM_WFL_ALTCAT_CREATEF . "'>" . $imagearray['altcat'] . '</a> '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |         $icon .= '<a href="http://whois.domaintools.com/' . $hwhoisurl . '" target="_blank"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/domaintools.png" alt="WHOIS" title="WHOIS" align="absmiddle"></a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  |         echo " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  |         <tr class='txtcenter;'>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |         <td class='head'><small>" . $lid . "</small></td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  |         <td class='even' style='text-align: left;'><small>" . $title . "</small></td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |         <td class='even' style='text-align: left;'><small>" . $cattitle . "</small></td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  |         <td class='even'><small>" . $submitter . "</small></td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |         <td class='even'><small>" . $publish . "</small></td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  |         <td class='even'><small>" . $expires . "</small></td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |         <td class='even' width='4%'>" . $published_status . "</td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  |         <td class='even' style='text-align: center; width: 6%; white-space: nowrap;'>$icon</td>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  |         </tr>\n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  |         "; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |         unset($published); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  |      * @param $catt | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  |     public static function getCategoryTitle($catt) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  |         global $xoopsDB; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  |         $sql    = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $catt; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  |         $result = $xoopsDB->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  |         $result = $xoopsDB->fetchArray($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  |         return $result['title']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 |  |  |     public static function getLinkListFooter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  |         echo "<tr class='txtcenter;'>\n<td class='head' colspan='7'>" . _AM_WFL_MINDEX_NOLINKSFOUND . "</td>\n</tr>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 |  |  |      * @param        $pubrowamount | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  |      * @param        $start | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  |      * @param string $art | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  |      * @param string $_this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  |      * @return null | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 986 |  | View Code Duplication |     public static function getLinkListPageNav($pubrowamount, $start, $art = 'art', $_this = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 |  |  |         global $xoopsModuleConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 |  |  |         echo "</table>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 |  |  |         if ($pubrowamount < $xoopsModuleConfig['admin_perpage']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  |         // Display Page Nav if published is > total display pages amount. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  |         require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 |  |  |         //    $page = ( $pubrowamount > $xoopsModuleConfig['admin_perpage'] ) ? _AM_WFL_MINDEX_PAGE : ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 |  |  |         $pagenav = new XoopsPageNav($pubrowamount, $xoopsModuleConfig['admin_perpage'], $start, 'st' . $art, $_this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 |  |  |         echo '<div align="right" style="padding: 8px;">' . $pagenav->renderNav() . '</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  |      * @param        $pubrowamount | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 |  |  |      * @param        $start | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  |      * @param string $art | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  |      * @param string $_this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  |      * @return null | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1010 |  | View Code Duplication |     public static function getLinkListPageNavLeft($pubrowamount, $start, $art = 'art', $_this = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  |         global $xoopsModuleConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  |         //    echo "</table>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  |         if ($pubrowamount < $xoopsModuleConfig['admin_perpage']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 |  |  |         // Display Page Nav if published is > total display pages amount. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  |         require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  |         //    $page = ( $pubrowamount > $xoopsModuleConfig['admin_perpage'] ) ? _AM_WFL_MINDEX_PAGE : ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  |         $pagenav = new XoopsPageNav($pubrowamount, $xoopsModuleConfig['admin_perpage'], $start, 'st' . $art, $_this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  |         echo '<div align="left" style="padding: 8px;">' . $pagenav->renderNav() . '</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  |     // Retreive an editor according to the module's option "form_options" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  |      * @param $caption | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  |      * @param $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 |  |  |      * @param $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 |  |  |      * @return bool|\XoopsFormDhtmlTextArea|\XoopsFormEditor|\XoopsFormFckeditor|\XoopsFormHtmlarea|\XoopsFormTextArea | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  |     public static function getWysiwygForm($caption, $name, $value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  |         global $xoopsModuleConfig, $xoopsUser, $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  |         $editor = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  |         $x22    = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  |         $xv     = str_replace('XOOPS ', '', XOOPS_VERSION); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  |         if (substr($xv, 2, 1) == '2') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  |             $x22 = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  |         $editor_configs           = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  |         $editor_configs['name']   = $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 |  |  |         $editor_configs['value']  = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  |         $editor_configs['rows']   = 35; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 |  |  |         $editor_configs['cols']   = 60; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  |         $editor_configs['width']  = '100%'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  |         $editor_configs['height'] = '400px'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  |         $isadmin = ((is_object($xoopsUser) && !empty($xoopsUser)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  |                     && $xoopsUser->isAdmin($xoopsModule->mid())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  |         if ($isadmin === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  |             $formuser = $xoopsModuleConfig['form_options']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  |             $formuser = $xoopsModuleConfig['form_optionsuser']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  |         switch ($formuser) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  |             case 'fck': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  |                     if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/fckeditor/formfckeditor.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  |                         require_once XOOPS_ROOT_PATH . '/class/xoopseditor/fckeditor/formfckeditor.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  |                         $editor = new XoopsFormFckeditor($editor_configs, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  |                         if ($dhtml) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  |                             $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  |                             $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  |                     $editor = new XoopsFormEditor($caption, 'fckeditor', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  |             case 'htmlarea': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 |  |  |                     if (is_readable(XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  |                         require_once XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  |                         $editor = new XoopsFormHtmlarea($caption, $name, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 |  |  |                     $editor = new XoopsFormEditor($caption, 'htmlarea', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1090 |  |  |             case 'dhtml': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1091 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1092 |  |  |                     $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1093 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 |  |  |                     $editor = new XoopsFormEditor($caption, 'dhtmltextarea', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  |             case 'textarea': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  |                 $editor = new XoopsFormTextArea($caption, $name, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 |  |  |             case 'koivi': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 |  |  |                     if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/koivi/formwysiwygtextarea.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |                         require_once XOOPS_ROOT_PATH . '/class/xoopseditor/koivi/formwysiwygtextarea.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  |                         $editor = new XoopsFormWysiwygTextArea($caption, $name, $value, '100%', '400px'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  |                         if ($dhtml) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  |                             $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  |                             $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 |  |  |                     $editor = new XoopsFormEditor($caption, 'koivi', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  |             case 'tinyeditor': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 |  |  |                     if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  |                         require_once XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  |                         $editor = new XoopsFormTinyeditorTextArea(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  |                                                                       'caption' => $caption, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  |                                                                       'name'    => $name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  |                                                                       'value'   => $value, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  |                                                                       'width'   => '100%', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  |                                                                       'height'  => '400px' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  |                                                                   )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  |                         if ($dhtml) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  |                             $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 50, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  |                             $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 |  |  |                     $editor = new XoopsFormEditor($caption, 'tinyeditor', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 |  |  |             case 'dhtmlext': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  |                     if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/dhtmlext/dhtmlext.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  |                         require_once XOOPS_ROOT_PATH . '/class/xoopseditor/dhtmlext/dhtmlext.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 |  |  |                         $editor = new XoopsFormDhtmlTextAreaExtended($caption, $name, $value, 10, 50); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  |                         if ($dhtml) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  |                             $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 50, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 |  |  |                             $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  |                     $editor = new XoopsFormEditor($caption, 'dhtmlext', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 |  |  |             case 'tinymce': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  |                 if (!$x22) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 |  |  |                     if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/tinymce/formtinymce.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  |                         require_once XOOPS_ROOT_PATH . '/class/xoopseditor/tinymce/formtinymce.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  |                         $editor = new XoopsFormTinymce(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  |                                                            'caption' => $caption, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  |                                                            'name'    => $name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  |                                                            'value'   => $value, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 |  |  |                                                            'width'   => '100%', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  |                                                            'height'  => '400px' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 |  |  |                                                        )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  |                     } elseif (is_readable(XOOPS_ROOT_PATH . '/editors/tinymce/formtinymce.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  |                         require_once XOOPS_ROOT_PATH . '/editors/tinymce/formtinymce.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  |                         $editor = new XoopsFormTinymce(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  |                                                            'caption' => $caption, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  |                                                            'name'    => $name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 |  |  |                                                            'value'   => $value, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  |                                                            'width'   => '100%', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 |  |  |                                                            'height'  => '400px' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  |                                                        )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  |                         if ($dhtml) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  |                             $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  |                             $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1187 |  |  |                     $editor = new XoopsFormEditor($caption, 'tinymce', $editor_configs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1188 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1189 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1190 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1191 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1192 |  |  |         return $editor; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1193 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1194 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1195 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1196 |  |  |      * @param $countryn | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1197 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1198 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1199 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1200 |  |  |     public static function getCountryName($countryn) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1201 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1202 |  |  |         $country_array = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1203 |  |  |             ''   => 'Unknown', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1204 |  |  |             '-'  => 'Unknown', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1205 |  |  |             'AD' => 'Andorra', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1206 |  |  |             'AE' => 'United Arab Emirates', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1207 |  |  |             'AF' => 'Afghanistan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1208 |  |  |             'AG' => 'Antigua and Barbuda', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1209 |  |  |             'AI' => 'Anguilla', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1210 |  |  |             'AL' => 'Albania', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1211 |  |  |             'AM' => 'Armenia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1212 |  |  |             'AN' => 'Netherlands Antilles', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1213 |  |  |             'AO' => 'Angola', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1214 |  |  |             'AQ' => 'Antarctica', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1215 |  |  |             'AR' => 'Argentina', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1216 |  |  |             'AS' => 'American Samoa', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1217 |  |  |             'AT' => 'Austria', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1218 |  |  |             'AU' => 'Australia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1219 |  |  |             'AW' => 'Aruba', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1220 |  |  |             'AX' => 'Åland Islands',   // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1221 |  |  |             'AZ' => 'Azerbaijan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1222 |  |  |             'BA' => 'Bosnia and Herzegovina', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1223 |  |  |             'BB' => 'Barbados', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1224 |  |  |             'BD' => 'Bangladesh', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1225 |  |  |             'BE' => 'Belgium', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1226 |  |  |             'BF' => 'Burkina Faso', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1227 |  |  |             'BG' => 'Bulgaria', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1228 |  |  |             'BH' => 'Bahrain', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1229 |  |  |             'BI' => 'Burundi', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1230 |  |  |             'BJ' => 'Benin', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1231 |  |  |             'BL' => 'Saint Barthélemy',   // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1232 |  |  |             'BM' => 'Bermuda', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1233 |  |  |             'BN' => 'Brunei Darussalam', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1234 |  |  |             'BO' => 'Bolivia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1235 |  |  |             'BR' => 'Brazil', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1236 |  |  |             'BS' => 'Bahamas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1237 |  |  |             'BT' => 'Bhutan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1238 |  |  |             'BV' => 'Bouvet Island', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1239 |  |  |             'BW' => 'Botswana', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1240 |  |  |             'BY' => 'Belarus', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1241 |  |  |             'BZ' => 'Belize', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1242 |  |  |             'CA' => 'Canada', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1243 |  |  |             'CC' => 'Cocos (Keeling) Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1244 |  |  |             'CD' => 'Congo (Dem. Rep.)',   // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1245 |  |  |             'CF' => 'Central African Republic', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1246 |  |  |             'CG' => 'Congo', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1247 |  |  |             'CH' => 'Switzerland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1248 |  |  |             'CI' => "Cote D'Ivoire", // Removed: (Ivory Coast) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1249 |  |  |             'CK' => 'Cook Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1250 |  |  |             'CL' => 'Chile', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1251 |  |  |             'CM' => 'Cameroon', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1252 |  |  |             'CN' => 'China', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1253 |  |  |             'CO' => 'Colombia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1254 |  |  |             'CR' => 'Costa Rica', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1255 |  |  |             'CS' => 'Czechoslovakia (former)',   // Not listed anymore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1256 |  |  |             'CU' => 'Cuba', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1257 |  |  |             'CV' => 'Cape Verde', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1258 |  |  |             'CX' => 'Christmas Island', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1259 |  |  |             'CY' => 'Cyprus', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1260 |  |  |             'CZ' => 'Czech Republic', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1261 |  |  |             'DE' => 'Germany', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1262 |  |  |             'DJ' => 'Djibouti', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1263 |  |  |             'DK' => 'Denmark', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1264 |  |  |             'DM' => 'Dominica', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1265 |  |  |             'DO' => 'Dominican Republic', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1266 |  |  |             'DZ' => 'Algeria', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1267 |  |  |             'EC' => 'Ecuador', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1268 |  |  |             'EE' => 'Estonia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1269 |  |  |             'EG' => 'Egypt', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1270 |  |  |             'EH' => 'Western Sahara', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1271 |  |  |             'ER' => 'Eritrea', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1272 |  |  |             'ES' => 'Spain', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1273 |  |  |             'EU' => 'Europe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1274 |  |  |             'ET' => 'Ethiopia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1275 |  |  |             'FI' => 'Finland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1276 |  |  |             'FJ' => 'Fiji', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1277 |  |  |             'FK' => 'Falkland Islands (Malvinas)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1278 |  |  |             'FM' => 'Micronesia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1279 |  |  |             'FO' => 'Faroe Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1280 |  |  |             'FR' => 'France', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1281 |  |  |             'FX' => 'France, Metropolitan',   // Not listed anymore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1282 |  |  |             'GA' => 'Gabon', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1283 |  |  |             'GB' => 'Great Britain',     // Name was: Great Britain (UK) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1284 |  |  |             'GD' => 'Grenada', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1285 |  |  |             'GE' => 'Georgia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1286 |  |  |             'GF' => 'French Guiana', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1287 |  |  |             'GG' => 'Guernsey',   // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1288 |  |  |             'GH' => 'Ghana', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1289 |  |  |             'GI' => 'Gibraltar', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1290 |  |  |             'GL' => 'Greenland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1291 |  |  |             'GM' => 'Gambia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1292 |  |  |             'GN' => 'Guinea', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1293 |  |  |             'GP' => 'Guadeloupe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1294 |  |  |             'GQ' => 'Equatorial Guinea', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1295 |  |  |             'GR' => 'Greece', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1296 |  |  |             'GS' => 'S. Georgia and S. Sandwich Isls.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1297 |  |  |             'GT' => 'Guatemala', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1298 |  |  |             'GU' => 'Guam', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1299 |  |  |             'GW' => 'Guinea-Bissau', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1300 |  |  |             'GY' => 'Guyana', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1301 |  |  |             'HK' => 'Hong Kong', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1302 |  |  |             'HM' => 'Heard and McDonald Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1303 |  |  |             'HN' => 'Honduras', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1304 |  |  |             'HR' => 'Croatia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1305 |  |  |             'HT' => 'Haiti', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1306 |  |  |             'HU' => 'Hungary', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1307 |  |  |             'ID' => 'Indonesia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1308 |  |  |             'IE' => 'Ireland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1309 |  |  |             'IL' => 'Israel', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1310 |  |  |             'IM' => 'Isle of Man',    //  Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1311 |  |  |             'IN' => 'India', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1312 |  |  |             'IO' => 'British Indian Ocean Territory', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1313 |  |  |             'IQ' => 'Iraq', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1314 |  |  |             'IR' => 'Iran',   //  Changed name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1315 |  |  |             'IS' => 'Iceland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1316 |  |  |             'IT' => 'Italy', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1317 |  |  |             'JE' => 'Jersey', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1318 |  |  |             'JM' => 'Jamaica', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1319 |  |  |             'JO' => 'Jordan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1320 |  |  |             'JP' => 'Japan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1321 |  |  |             'KE' => 'Kenya', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1322 |  |  |             'KG' => 'Kyrgyzstan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1323 |  |  |             'KH' => 'Cambodia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1324 |  |  |             'KI' => 'Kiribati', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1325 |  |  |             'KM' => 'Comoros', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1326 |  |  |             'KN' => 'Saint Kitts and Nevis', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1327 |  |  |             'KP' => 'Korea (North)',    // Official name: Korea, Democratic People's Republic of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1328 |  |  |             'KR' => 'Korea (South)',    // Official name: Korea, Republic of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1329 |  |  |             'KW' => 'Kuwait', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1330 |  |  |             'KY' => 'Cayman Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1331 |  |  |             'KZ' => 'Kazakhstan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1332 |  |  |             'LA' => 'Laos',             // Official name: Lao People's Democratic Republic | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1333 |  |  |             'LB' => 'Lebanon', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1334 |  |  |             'LC' => 'Saint Lucia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1335 |  |  |             'LI' => 'Liechtenstein', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1336 |  |  |             'LK' => 'Sri Lanka', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1337 |  |  |             'LR' => 'Liberia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1338 |  |  |             'LS' => 'Lesotho', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1339 |  |  |             'LT' => 'Lithuania', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1340 |  |  |             'LU' => 'Luxembourg', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1341 |  |  |             'LV' => 'Latvia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1342 |  |  |             'LY' => 'Libya',            // Official name: Libyan Arab Jamahiriya | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1343 |  |  |             'MA' => 'Morocco', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1344 |  |  |             'MC' => 'Monaco', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1345 |  |  |             'MD' => 'Moldova',          // Official name: Moldova, Republic of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1346 |  |  |             'ME' => 'Montenegro',       // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1347 |  |  |             'MF' => 'Saint Martin',     // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1348 |  |  |             'MG' => 'Madagascar', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1349 |  |  |             'MH' => 'Marshall Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1350 |  |  |             'MK' => 'Macedonia',        // Official name: Macedonia, The Former Yugoslav Republic of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1351 |  |  |             'ML' => 'Mali', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1352 |  |  |             'MM' => 'Myanmar', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1353 |  |  |             'MN' => 'Mongolia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1354 |  |  |             'MO' => 'Macao',            // Corrected name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1355 |  |  |             'MP' => 'Northern Mariana Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1356 |  |  |             'MQ' => 'Martinique', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1357 |  |  |             'MR' => 'Mauritania', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1358 |  |  |             'MS' => 'Montserrat', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1359 |  |  |             'MT' => 'Malta', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1360 |  |  |             'MU' => 'Mauritius', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1361 |  |  |             'MV' => 'Maldives', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1362 |  |  |             'MW' => 'Malawi', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1363 |  |  |             'MX' => 'Mexico', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1364 |  |  |             'MY' => 'Malaysia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1365 |  |  |             'MZ' => 'Mozambique', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1366 |  |  |             'NA' => 'Namibia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1367 |  |  |             'NC' => 'New Caledonia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1368 |  |  |             'NE' => 'Niger', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1369 |  |  |             'NF' => 'Norfolk Island', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1370 |  |  |             'NG' => 'Nigeria', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1371 |  |  |             'NI' => 'Nicaragua', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1372 |  |  |             'NL' => 'Netherlands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1373 |  |  |             'NO' => 'Norway', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1374 |  |  |             'NP' => 'Nepal', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1375 |  |  |             'NR' => 'Nauru', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1376 |  |  |             'NT' => 'Neutral Zone', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1377 |  |  |             'NU' => 'Niue', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1378 |  |  |             'NZ' => 'New Zealand', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1379 |  |  |             'OM' => 'Oman', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1380 |  |  |             'PA' => 'Panama', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1381 |  |  |             'PE' => 'Peru', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1382 |  |  |             'PF' => 'French Polynesia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1383 |  |  |             'PG' => 'Papua New Guinea', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1384 |  |  |             'PH' => 'Philippines', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1385 |  |  |             'PK' => 'Pakistan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1386 |  |  |             'PL' => 'Poland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1387 |  |  |             'PM' => 'St. Pierre and Miquelon', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1388 |  |  |             'PN' => 'Pitcairn', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1389 |  |  |             'PR' => 'Puerto Rico', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1390 |  |  |             'PS' => 'Palestinian Territory, Occupied',   // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1391 |  |  |             'PT' => 'Portugal', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1392 |  |  |             'PW' => 'Palau', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1393 |  |  |             'PY' => 'Paraguay', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1394 |  |  |             'QA' => 'Qatar', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1395 |  |  |             'RE' => 'Reunion', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1396 |  |  |             'RO' => 'Romania', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1397 |  |  |             'RS' => 'Serbia',     // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1398 |  |  |             'RU' => 'Russian Federation', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1399 |  |  |             'RW' => 'Rwanda', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1400 |  |  |             'SA' => 'Saudi Arabia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1401 |  |  |             'SB' => 'Solomon Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1402 |  |  |             'SC' => 'Seychelles', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1403 |  |  |             'SD' => 'Sudan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1404 |  |  |             'SE' => 'Sweden', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1405 |  |  |             'SG' => 'Singapore', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1406 |  |  |             'SH' => 'St. Helena', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1407 |  |  |             'SI' => 'Slovenia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1408 |  |  |             'SJ' => 'Svalbard and Jan Mayen Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1409 |  |  |             'SK' => 'Slovakia',              // Changed name, was: Slovak Republic | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1410 |  |  |             'SL' => 'Sierra Leone', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1411 |  |  |             'SM' => 'San Marino', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1412 |  |  |             'SN' => 'Senegal', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1413 |  |  |             'SO' => 'Somalia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1414 |  |  |             'SR' => 'Suriname', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1415 |  |  |             'ST' => 'Sao Tome and Principe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1416 |  |  |             'SU' => 'USSR (former)',          // Removed from ISO list, doesn' exsist anymore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1417 |  |  |             'SV' => 'El Salvador', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1418 |  |  |             'SY' => 'Syrian Arab Republic',   // Changed name, was: Syria | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1419 |  |  |             'SZ' => 'Swaziland', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1420 |  |  |             'TC' => 'Turks and Caicos Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1421 |  |  |             'TD' => 'Chad', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1422 |  |  |             'TF' => 'French Southern Territories', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1423 |  |  |             'TG' => 'Togo', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1424 |  |  |             'TH' => 'Thailand', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1425 |  |  |             'TJ' => 'Tajikistan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1426 |  |  |             'TK' => 'Tokelau', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1427 |  |  |             'TL' => 'Timor-Leste',    // Added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1428 |  |  |             'TM' => 'Turkmenistan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1429 |  |  |             'TN' => 'Tunisia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1430 |  |  |             'TO' => 'Tonga', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1431 |  |  |             'TP' => 'East Timor',             // Removed from ISO list, doesn' exsist anymore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1432 |  |  |             'TR' => 'Turkey', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1433 |  |  |             'TT' => 'Trinidad and Tobago', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1434 |  |  |             'TV' => 'Tuvalu', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1435 |  |  |             'TW' => 'Taiwan',         // Official name acc. to iso-list: Taiwan, Province of China | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1436 |  |  |             'TZ' => 'Tanzania', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1437 |  |  |             'UA' => 'Ukraine', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1438 |  |  |             'UG' => 'Uganda', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1439 |  |  |             'UK' => 'United Kingdom',      // Doesn't exsist in iso-list ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1440 |  |  |             'UM' => 'US Minor Outlying Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1441 |  |  |             'US' => 'United States', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1442 |  |  |             'UY' => 'Uruguay', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1443 |  |  |             'UZ' => 'Uzbekistan', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1444 |  |  |             'VA' => 'Vatican City State', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1445 |  |  |             'VC' => 'Saint Vincent and the Grenadines', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1446 |  |  |             'VE' => 'Venezuela', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1447 |  |  |             'VG' => 'Virgin Islands, British', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1448 |  |  |             'VI' => 'Virgin Islands, U.S.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1449 |  |  |             'VN' => 'Viet Nam', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1450 |  |  |             'VU' => 'Vanuatu', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1451 |  |  |             'WF' => 'Wallis and Futuna Islands', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1452 |  |  |             'WS' => 'Samoa', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1453 |  |  |             'YE' => 'Yemen', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1454 |  |  |             'YT' => 'Mayotte', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1455 |  |  |             'YU' => 'Yugoslavia',        // Removed from iso list | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1456 |  |  |             'ZA' => 'South Africa', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1457 |  |  |             'ZM' => 'Zambia', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1458 |  |  |             'ZR' => 'Zaire',             // Removed from iso list | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1459 |  |  |             'ZW' => 'Zimbabwe' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1460 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1461 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1462 |  |  |         return $country_array[$countryn]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1463 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1464 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1465 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1466 |  |  |      * @param $document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1467 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1468 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1469 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1470 |  |  |     public static function convertHtml2text($document) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1471 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1472 |  |  |         $search = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1473 |  |  |             "'<script[^>]*?>.*?</script>'si", // Strip out javascript | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1474 |  |  |             "'<img.*?>'si", // Strip out img tags | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1475 |  |  |             "'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1476 |  |  |             "'([\r\n])[\s]+'", // Strip out white space | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1477 |  |  |             "'&(quot|#34);'i", // Replace HTML entities | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1478 |  |  |             "'&(amp|#38);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1479 |  |  |             "'&(lt|#60);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1480 |  |  |             "'&(gt|#62);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1481 |  |  |             "'&(nbsp|#160);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1482 |  |  |             "'&(iexcl|#161);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1483 |  |  |             "'&(cent|#162);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1484 |  |  |             "'&(pound|#163);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1485 |  |  |             "'&(copy|#169);'i" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1486 |  |  |         ); // evaluate as php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1487 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1488 |  |  |         $replace = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1489 |  |  |             '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1490 |  |  |             '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1491 |  |  |             '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1492 |  |  |             "\\1", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1493 |  |  |             '"', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1494 |  |  |             '&', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1495 |  |  |             '<', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1496 |  |  |             '>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1497 |  |  |             ' ', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1498 |  |  |             chr(161), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1499 |  |  |             chr(162), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1500 |  |  |             chr(163), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1501 |  |  |             chr(169), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1502 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1503 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1504 |  |  |         $text = preg_replace($search, $replace, $document); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1505 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1506 |  |  |         preg_replace_callback('/&#(\d+);/', function ($matches) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1507 |  |  |             return chr($matches[1]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1508 |  |  |         }, $document); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1509 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1510 |  |  |         return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1511 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1512 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1513 |  |  |     //    Start functions for Google PageRank | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1514 |  |  |     //    Source: http://www.sws-tech.com/scripts/googlepagerank.php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1515 |  |  |     //    This code is released under the public domain | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1516 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1517 |  |  |      * @param $a | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1518 |  |  |      * @param $b | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1519 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1520 |  |  |      * @return float|int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1521 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1522 |  |  |     public static function fillZeroes($a, $b) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1523 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1524 |  |  |         $z = hexdec(80000000); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1525 |  |  |         //echo $z; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1526 |  |  |         if ($z & $a) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1527 |  |  |             $a >>= 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1528 |  |  |             $a &= (~$z); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1529 |  |  |             $a |= 0x40000000; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1530 |  |  |             $a >>= ($b - 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1531 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1532 |  |  |             $a >>= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1533 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1534 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1535 |  |  |         return $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1536 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1537 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1538 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1539 |  |  |      * @param $a | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1540 |  |  |      * @param $b | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1541 |  |  |      * @param $c | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1542 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1543 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1544 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1545 |  |  |     public static function mix($a, $b, $c) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1546 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1547 |  |  |         $a -= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1548 |  |  |         $a -= $c; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1549 |  |  |         $a ^= static::fillZeroes($c, 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1550 |  |  |         $b -= $c; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1551 |  |  |         $b -= $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1552 |  |  |         $b ^= ($a << 8); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1553 |  |  |         $c -= $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1554 |  |  |         $c -= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1555 |  |  |         $c ^= static::fillZeroes($b, 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1556 |  |  |         $a -= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1557 |  |  |         $a -= $c; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1558 |  |  |         $a ^= static::fillZeroes($c, 12); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1559 |  |  |         $b -= $c; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1560 |  |  |         $b -= $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1561 |  |  |         $b ^= ($a << 16); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1562 |  |  |         $c -= $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1563 |  |  |         $c -= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1564 |  |  |         $c ^= static::fillZeroes($b, 5); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1565 |  |  |         $a -= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1566 |  |  |         $a -= $c; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1567 |  |  |         $a ^= static::fillZeroes($c, 3); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1568 |  |  |         $b -= $c; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1569 |  |  |         $b -= $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1570 |  |  |         $b ^= ($a << 10); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1571 |  |  |         $c -= $a; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1572 |  |  |         $c -= $b; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1573 |  |  |         $c ^= static::fillZeroes($b, 15); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1574 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1575 |  |  |         return array($a, $b, $c); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1576 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1578 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1579 |  |  |      * @param      $url | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1580 |  |  |      * @param null $length | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1581 |  |  |      * @param int  $init | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1582 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1583 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1584 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1585 |  |  |     public static function GoogleCH($url, $length = null, $init = 0xE6359A60) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1586 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1587 |  |  |         if (null === $length) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1588 |  |  |             $length = count($url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1589 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1590 |  |  |         $a   = $b = 0x9E3779B9; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1591 |  |  |         $c   = $init; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1592 |  |  |         $k   = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1593 |  |  |         $len = $length; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1594 |  |  |         while ($len >= 12) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1595 |  |  |             $a   += ($url[$k + 0] + ($url[$k + 1] << 8) + ($url[$k + 2] << 16) + ($url[$k + 3] << 24)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1596 |  |  |             $b   += ($url[$k + 4] + ($url[$k + 5] << 8) + ($url[$k + 6] << 16) + ($url[$k + 7] << 24)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1597 |  |  |             $c   += ($url[$k + 8] + ($url[$k + 9] << 8) + ($url[$k + 10] << 16) + ($url[$k + 11] << 24)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1598 |  |  |             $mix = mix($a, $b, $c); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1599 |  |  |             $a   = $mix[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1600 |  |  |             $b   = $mix[1]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1601 |  |  |             $c   = $mix[2]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1602 |  |  |             $k   += 12; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1603 |  |  |             $len -= 12; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1604 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1605 |  |  |         $c += $length; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1606 |  |  |         switch ($len) {              /* all the case statements fall through */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1607 |  |  |             case 11: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1608 |  |  |                 $c += ($url[$k + 10] << 24); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1609 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1610 |  |  |             case 10: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1611 |  |  |                 $c += ($url[$k + 9] << 16); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1612 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1613 |  |  |             case 9: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1614 |  |  |                 $c += ($url[$k + 8] << 8); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1615 |  |  |             /* the first byte of c is reserved for the length */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1616 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1617 |  |  |             case 8: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1618 |  |  |                 $b += ($url[$k + 7] << 24); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1619 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1620 |  |  |             case 7: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1621 |  |  |                 $b += ($url[$k + 6] << 16); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1622 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1623 |  |  |             case 6: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1624 |  |  |                 $b += ($url[$k + 5] << 8); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1625 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1626 |  |  |             case 5: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1627 |  |  |                 $b += $url[$k + 4]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1628 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1629 |  |  |             case 4: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1630 |  |  |                 $a += ($url[$k + 3] << 24); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1631 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1632 |  |  |             case 3: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1633 |  |  |                 $a += ($url[$k + 2] << 16); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1634 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1635 |  |  |             case 2: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1636 |  |  |                 $a += ($url[$k + 1] << 8); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1637 |  |  |             // no break | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1638 |  |  |             case 1: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1639 |  |  |                 $a += $url[$k + 0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1640 |  |  |             /* case 0: nothing left to add */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1641 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1642 |  |  |         $mix = mix($a, $b, $c); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1643 |  |  |         //echo $mix[0]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1644 |  |  |         /*-------------------------------------------- report the result */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1645 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1646 |  |  |         return $mix[2]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1647 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1648 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1649 |  |  |     //converts a string into an array of integers containing the numeric value of the char | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1650 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1651 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1652 |  |  |      * @param $string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1653 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1654 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1655 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1656 |  |  |     public static function strord($string) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1657 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1658 |  |  |         for ($i = 0, $iMax = strlen($string); $i < $iMax; ++$i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1659 |  |  |             $result[$i] = ord($string{$i}); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1660 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1661 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1662 |  |  |         return $result; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1663 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1664 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1665 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1666 |  |  |      * @param $url | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1667 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1668 |  |  |      * @return bool|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1669 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1670 |  |  |     public static function pagerank($url) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1671 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1672 |  |  |         $pagerank = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1673 |  |  |         $ch       = '6' . GoogleCH(strord('info:' . $url)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1674 |  |  |         $fp       = fsockopen('www.google.com', 80, $errno, $errstr, 30); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1675 |  |  |         if (!$fp) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1676 |  |  |             echo "$errstr ($errno)<br>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1677 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1678 |  |  |             $out = 'GET /search?client=navclient-auto&ch=' . $ch . '&features=Rank&q=info:' . $url . " HTTP/1.1\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1679 |  |  |             $out .= "Host: www.google.com\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1680 |  |  |             $out .= "Connection: Close\r\n\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1681 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1682 |  |  |             fwrite($fp, $out); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1683 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1684 |  |  |             while (!feof($fp)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1685 |  |  |                 $data = fgets($fp, 128); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1686 |  |  |                 $pos  = strpos($data, 'Rank_'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1687 |  |  |                 if ($pos === false) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1688 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1689 |  |  |                     $pagerank = substr($data, $pos + 9); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1690 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1691 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1692 |  |  |             fclose($fp); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1693 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1694 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1695 |  |  |         return $pagerank; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1696 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1697 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1698 |  |  |     //  End functions for Google PageRank | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1699 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1700 |  |  |     // Check if Tag module is installed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1701 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1702 |  |  |      * @return bool | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1703 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1704 |  | View Code Duplication |     public static function isTagModuleIncluded() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1705 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1706 |  |  |         static $wfl_tag_module_included; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1707 |  |  |         if (!isset($wfl_tag_module_included)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1708 |  |  |             $modulesHandler = xoops_getHandler('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1709 |  |  |             $tag_mod        = $modulesHandler->getByDirName('tag'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1710 |  |  |             if (!$tag_mod) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1711 |  |  |                 $tag_mod = false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1712 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1713 |  |  |                 $wfl_tag_module_included = $tag_mod->getVar('isactive') == 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1714 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1715 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1716 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1717 |  |  |         return $wfl_tag_module_included; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1718 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1719 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1720 |  |  |     // Add item_tag to Tag-module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1721 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1722 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1723 |  |  |      * @param $lid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1724 |  |  |      * @param $item_tag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1725 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1726 |  |  |     public static function updateTag($lid, $item_tag) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1727 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1728 |  |  |         global $xoopsModule; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1729 |  |  |         if (static::isTagModuleIncluded()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1730 |  |  |             require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1731 |  |  |             $tagHandler = xoops_getModuleHandler('tag', 'tag'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1732 |  |  |             $tagHandler->updateByItem($item_tag, $lid, $xoopsModule->getVar('dirname'), 0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1733 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1734 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1735 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1736 |  |  |     // Check if News module is installed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1737 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1738 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1739 |  |  |      * @return bool | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1740 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1741 |  | View Code Duplication |     public static function isNewsModuleIncluded() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1742 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1743 |  |  |         static $wfl_news_module_included; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1744 |  |  |         if (!isset($wfl_news_module_included)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1745 |  |  |             $modulesHandler = xoops_getHandler('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1746 |  |  |             $news_mod       = $modulesHandler->getByDirName('news'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1747 |  |  |             if (!$news_mod) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1748 |  |  |                 $news_mod = false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1749 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1750 |  |  |                 $wfl_news_module_included = $news_mod->getVar('isactive') == 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1751 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1752 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1753 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1754 |  |  |         return $wfl_news_module_included; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1755 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1756 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1757 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1758 |  |  |      * @param $banner_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1759 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1760 |  |  |      * @return null|string | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1761 |  |  |      */ | 
            
                                                                        
                            
            
                                                                    
                                                                                                        
            
            
                | 1762 |  | View Code Duplication |     public static function getBannerFromIdBanner($banner_id) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 1763 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 1764 |  |  |         ###### Hack by www.stefanosilvestrini.com ###### | 
            
                                                                        
                            
            
                                    
            
            
                | 1765 |  |  |         global $xoopsConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 1766 |  |  |         $db      = XoopsDatabaseFactory::getDatabaseConnection(); | 
            
                                                                        
                            
            
                                    
            
            
                | 1767 |  |  |         $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id); | 
            
                                                                        
                            
            
                                    
            
            
                | 1768 |  |  |         list($numrows) = $db->fetchRow($bresult); | 
            
                                                                        
                            
            
                                    
            
            
                | 1769 |  |  |         if ($numrows > 1) { | 
            
                                                                        
                            
            
                                    
            
            
                | 1770 |  |  |             --$numrows; | 
            
                                                                        
                            
            
                                    
            
            
                | 1771 |  |  |             mt_srand((double)microtime() * 1000000); | 
            
                                                                        
                            
            
                                    
            
            
                | 1772 |  |  |             $bannum = mt_rand(0, $numrows); | 
            
                                                                        
                            
            
                                    
            
            
                | 1773 |  |  |         } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 1774 |  |  |             $bannum = 0; | 
            
                                                                        
                            
            
                                    
            
            
                | 1775 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 1776 |  |  |         if ($numrows > 0) { | 
            
                                                                        
                            
            
                                    
            
            
                | 1777 |  |  |             $bresult = $db->query('SELECT * FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id, 1, $bannum); | 
            
                                                                        
                            
            
                                    
            
            
                | 1778 |  |  |             list($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 1779 |  |  |             if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 1780 |  |  |                 // EMPTY | 
            
                                                                        
                            
            
                                    
            
            
                | 1781 |  |  |             } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 1782 |  |  |                 $db->queryF(sprintf('UPDATE %s SET impmade = impmade+1 WHERE bid = %u', $db->prefix('banner'), $bid)); | 
            
                                                                        
                            
            
                                    
            
            
                | 1783 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 1784 |  |  |             /* Check if this impression is the last one and print the banner */ | 
            
                                                                        
                            
            
                                    
            
            
                | 1785 |  |  |             if ($imptotal == $impmade) { | 
            
                                                                        
                            
            
                                    
            
            
                | 1786 |  |  |                 $newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq'); | 
            
                                                                        
                            
            
                                    
            
            
                | 1787 |  |  |                 $sql   = sprintf('INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', $db->prefix('bannerfinish'), $newid, $cid, $impmade, $clicks, $date, time()); | 
            
                                                                        
                            
            
                                    
            
            
                | 1788 |  |  |                 $db->queryF($sql); | 
            
                                                                        
                            
            
                                    
            
            
                | 1789 |  |  |                 $db->queryF(sprintf('DELETE FROM %s WHERE bid = %u', $db->prefix('banner'), $bid)); | 
            
                                                                        
                            
            
                                    
            
            
                | 1790 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 1791 |  |  |             if ($htmlbanner) { | 
            
                                                                        
                            
            
                                    
            
            
                | 1792 |  |  |                 $bannerobject = $htmlcode; | 
            
                                                                        
                            
            
                                    
            
            
                | 1793 |  |  |             } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 1794 |  |  |                 $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">'; | 
            
                                                                        
                            
            
                                    
            
            
                | 1795 |  |  |                 if (stristr($imageurl, '.swf')) { | 
            
                                                                        
                            
            
                                    
            
            
                | 1796 |  |  |                     $bannerobject = $bannerobject | 
            
                                                                        
                            
            
                                    
            
            
                | 1797 |  |  |                                     . '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">' | 
            
                                                                        
                            
            
                                    
            
            
                | 1798 |  |  |                                     . '<param name="movie" value="' | 
            
                                                                        
                            
            
                                    
            
            
                | 1799 |  |  |                                     . $imageurl | 
            
                                                                        
                            
            
                                    
            
            
                | 1800 |  |  |                                     . '"></param>' | 
            
                                                                        
                            
            
                                    
            
            
                | 1801 |  |  |                                     . '<param name="quality" value="high"></param>' | 
            
                                                                        
                            
            
                                    
            
            
                | 1802 |  |  |                                     . '<embed src="' | 
            
                                                                        
                            
            
                                    
            
            
                | 1803 |  |  |                                     . $imageurl | 
            
                                                                        
                            
            
                                    
            
            
                | 1804 |  |  |                                     . '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">' | 
            
                                                                        
                            
            
                                    
            
            
                | 1805 |  |  |                                     . '</embed>' | 
            
                                                                        
                            
            
                                    
            
            
                | 1806 |  |  |                                     . '</object>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 1807 |  |  |                 } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 1808 |  |  |                     $bannerobject = $bannerobject . '<img src="' . $imageurl . '" alt="">'; | 
            
                                                                        
                            
            
                                    
            
            
                | 1809 |  |  |                 } | 
            
                                                                        
                            
            
                                    
            
            
                | 1810 |  |  |                 $bannerobject .= '</a></div>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 1811 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 1812 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 1813 |  |  |             return $bannerobject; | 
            
                                                                        
                            
            
                                    
            
            
                | 1814 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 1815 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 1816 |  |  |         return null; | 
            
                                                                        
                            
            
                                    
            
            
                | 1817 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1818 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1819 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1820 |  |  |      * @param $client_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1821 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1822 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1823 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1824 |  | View Code Duplication |     public static function getBannerFromIdClient($client_id) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1825 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1826 |  |  |         ###### Hack by www.stefanosilvestrini.com ###### | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1827 |  |  |         global $xoopsConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1828 |  |  |         $db      = XoopsDatabaseFactory::getDatabaseConnection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1829 |  |  |         $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1830 |  |  |         list($numrows) = $db->fetchRow($bresult); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1831 |  |  |         if ($numrows > 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1832 |  |  |             --$numrows; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1833 |  |  |             mt_srand((double)microtime() * 1000000); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1834 |  |  |             $bannum = mt_rand(0, $numrows); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1835 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1836 |  |  |             $bannum = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1837 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1838 |  |  |         if ($numrows > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1839 |  |  |             $bresult = $db->query('SELECT * FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id . ' ORDER BY rand()', 1, $bannum); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1840 |  |  |             list($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1841 |  |  |             if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1842 |  |  |                 // EMPTY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1843 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1844 |  |  |                 $db->queryF(sprintf('UPDATE %s SET impmade = impmade+1 WHERE bid = %u', $db->prefix('banner'), $bid)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1845 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1846 |  |  |             /* Check if this impression is the last one and print the banner */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1847 |  |  |             if ($imptotal == $impmade) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1848 |  |  |                 $newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1849 |  |  |                 $sql   = sprintf('INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', $db->prefix('bannerfinish'), $newid, $cid, $impmade, $clicks, $date, time()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1850 |  |  |                 $db->queryF($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1851 |  |  |                 $db->queryF(sprintf('DELETE FROM %s WHERE bid = %u', $db->prefix('banner'), $bid)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1852 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1853 |  |  |             if ($htmlbanner) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1854 |  |  |                 $bannerobject = $htmlcode; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1855 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1856 |  |  |                 $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1857 |  |  |                 if (stristr($imageurl, '.swf')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1858 |  |  |                     $bannerobject = $bannerobject | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1859 |  |  |                                     . '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1860 |  |  |                                     . '<param name="movie" value="' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1861 |  |  |                                     . $imageurl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1862 |  |  |                                     . '"></param>' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1863 |  |  |                                     . '<param name="quality" value="high"></param>' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1864 |  |  |                                     . '<embed src="' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1865 |  |  |                                     . $imageurl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1866 |  |  |                                     . '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1867 |  |  |                                     . '</embed>' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1868 |  |  |                                     . '</object>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1869 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1870 |  |  |                     $bannerobject = $bannerobject . '<img src="' . $imageurl . '" alt="">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1871 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1872 |  |  |                 $bannerobject .= '</a></div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1873 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1874 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1875 |  |  |             return $bannerobject; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1876 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1877 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1878 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1879 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1880 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1881 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1882 |  |  |      * @param $email | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1883 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1884 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1885 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1886 |  | View Code Duplication |     public function convertEmail($email) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1887 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1888 |  |  |         $search = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1889 |  |  |             "/\@/", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1890 |  |  |             "/\./", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1891 |  |  |             "/\mailto:/", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1892 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1893 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1894 |  |  |         $replace = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1895 |  |  |             ' AT ', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1896 |  |  |             ' DOT ', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1897 |  |  |             '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1898 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1899 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1900 |  |  |         $text = preg_replace($search, $replace, $email); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1901 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1902 |  |  |         return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1903 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1904 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1905 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1906 |  |  |      * @param $email | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1907 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1908 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1909 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1910 |  | View Code Duplication |     public function printemailcnvrt($email) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1911 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1912 |  |  |         $search = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1913 |  |  |             "/\ AT /", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1914 |  |  |             "/\ DOT /", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1915 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1916 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1917 |  |  |         $replace = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1918 |  |  |             '@', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1919 |  |  |             '.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1920 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1921 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1922 |  |  |         $text = preg_replace($search, $replace, $email); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1923 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1924 |  |  |         return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1925 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1926 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1927 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1928 |  |  |      * @param        $str | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1929 |  |  |      * @param        $start | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1930 |  |  |      * @param        $length | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1931 |  |  |      * @param string $trimmarker | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1932 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1933 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1934 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1935 |  |  |     public static function getSubstring($str, $start, $length, $trimmarker = '...') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1936 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1937 |  |  |         $configHandler          = xoops_getHandler('config'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1938 |  |  |         $im_multilanguageConfig = $configHandler->getConfigsByCat(IM_CONF_MULILANGUAGE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1939 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1940 |  |  |         if ($im_multilanguageConfig['ml_enable']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1941 |  |  |             $tags  = explode(',', $im_multilanguageConfig['ml_tags']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1942 |  |  |             $strs  = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1943 |  |  |             $hasML = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1944 |  |  |             foreach ($tags as $tag) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1945 |  |  |                 if (preg_match("/\[" . $tag . "](.*)\[\/" . $tag . "\]/sU", $str, $matches)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1946 |  |  |                     if (count($matches) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1947 |  |  |                         $hasML  = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1948 |  |  |                         $strs[] = $matches[1]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1949 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1950 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1951 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1952 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1953 |  |  |             $hasML = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1954 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1955 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1956 |  |  |         if (!$hasML) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1957 |  |  |             $strs = array($str); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1958 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1959 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1960 |  |  |         for ($i = 0; $i <= count($strs) - 1; ++$i) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1961 |  |  |             if (!XOOPS_USE_MULTIBYTES) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1962 |  |  |                 $strs[$i] = (strlen($strs[$i]) - $start <= $length) ? substr($strs[$i], $start, $length) : substr($strs[$i], $start, $length - strlen($trimmarker)) . $trimmarker; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1963 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1964 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1965 |  |  |             if (function_exists('mb_internal_encoding') && @mb_internal_encoding(_CHARSET)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1966 |  |  |                 $str2     = mb_strcut($strs[$i], $start, $length - strlen($trimmarker)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1967 |  |  |                 $strs[$i] = $str2 . (mb_strlen($strs[$i]) != mb_strlen($str2) ? $trimmarker : ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1968 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1969 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1970 |  |  |             // phppp patch | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1971 |  |  |             $DEP_CHAR = 127; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1972 |  |  |             $pos_st   = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1973 |  |  |             $action   = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1974 |  |  |             for ($pos_i = 0, $pos_iMax = strlen($strs[$i]); $pos_i < $pos_iMax; ++$pos_i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1975 |  |  |                 if (ord(substr($strs[$i], $pos_i, 1)) > 127) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1976 |  |  |                     ++$pos_i; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1977 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1978 |  |  |                 if ($pos_i <= $start) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1979 |  |  |                     $pos_st = $pos_i; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1980 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1981 |  |  |                 if ($pos_i >= $pos_st + $length) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1982 |  |  |                     $action = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1983 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1984 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1985 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1986 |  |  |             $strs[$i] = $action ? substr($strs[$i], $pos_st, $pos_i - $pos_st - strlen($trimmarker)) . $trimmarker : $strs[$i]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1987 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1988 |  |  |             $strs[$i] = $hasML ? '[' . $tags[$i] . ']' . $strs[$i] . '[/' . $tags[$i] . ']' : $strs[$i]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1989 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1990 |  |  |         $str = implode('', $strs); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1991 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1992 |  |  |         return $str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1993 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1994 |  |  |     // Reusable Link Sorting Functions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1995 |  |  |     // convertOrderByIn() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1996 |  |  |     // @param  $orderby | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1997 |  |  |     // @return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1998 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1999 |  |  |      * @param $orderby | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2000 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2001 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2002 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2003 |  |  |     public static function convertOrderByIn($orderby) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2004 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2005 |  |  |         switch (trim($orderby)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2006 |  |  |             case 'titleA': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2007 |  |  |                 $orderby = 'title ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2008 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2009 |  |  |             case 'dateA': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2010 |  |  |                 $orderby = 'published ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2011 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2012 |  |  |             case 'hitsA': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2013 |  |  |                 $orderby = 'hits ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2014 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2015 |  |  |             case 'ratingA': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2016 |  |  |                 $orderby = 'rating ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2017 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2018 |  |  |             case 'countryA': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2019 |  |  |                 $orderby = 'country ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2020 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2021 |  |  |             case 'titleD': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2022 |  |  |                 $orderby = 'title DESC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2023 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2024 |  |  |             case 'hitsD': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2025 |  |  |                 $orderby = 'hits DESC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2026 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2027 |  |  |             case 'ratingD': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2028 |  |  |                 $orderby = 'rating DESC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2029 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2030 |  |  |             case'dateD': | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2031 |  |  |                 $orderby = 'published DESC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2032 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2033 |  |  |             case 'countryD': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2034 |  |  |                 $orderby = 'country DESC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2035 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2036 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2037 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2038 |  |  |         return $orderby; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2039 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2040 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2041 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2042 |  |  |      * @param $orderby | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2043 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2044 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2045 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2046 |  |  |     public static function convertOrderByTrans($orderby) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2047 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2048 |  |  |         if ($orderby === 'hits ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2049 |  |  |             $orderbyTrans = _MD_WFL_POPULARITYLTOM; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2050 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2051 |  |  |         if ($orderby === 'hits DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2052 |  |  |             $orderbyTrans = _MD_WFL_POPULARITYMTOL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2053 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2054 |  |  |         if ($orderby === 'title ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2055 |  |  |             $orderbyTrans = _MD_WFL_TITLEATOZ; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2056 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2057 |  |  |         if ($orderby === 'title DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2058 |  |  |             $orderbyTrans = _MD_WFL_TITLEZTOA; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2059 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2060 |  |  |         if ($orderby === 'published ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2061 |  |  |             $orderbyTrans = _MD_WFL_DATEOLD; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2062 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2063 |  |  |         if ($orderby === 'published DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2064 |  |  |             $orderbyTrans = _MD_WFL_DATENEW; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2065 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2066 |  |  |         if ($orderby === 'rating ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2067 |  |  |             $orderbyTrans = _MD_WFL_RATINGLTOH; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2068 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2069 |  |  |         if ($orderby === 'rating DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2070 |  |  |             $orderbyTrans = _MD_WFL_RATINGHTOL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2071 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2072 |  |  |         if ($orderby === 'country ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2073 |  |  |             $orderbyTrans = _MD_WFL_COUNTRYLTOH; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2074 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2075 |  |  |         if ($orderby === 'country DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2076 |  |  |             $orderbyTrans = _MD_WFL_COUNTRYHTOL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2077 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2078 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2079 |  |  |         return $orderbyTrans; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2080 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2081 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2082 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2083 |  |  |      * @param $orderby | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2084 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2085 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2086 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2087 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2088 |  |  |     public static function convertOrderByOut($orderby) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2089 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2090 |  |  |         if ($orderby === 'title ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2091 |  |  |             $orderby = 'titleA'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2092 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2093 |  |  |         if ($orderby === 'published ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2094 |  |  |             $orderby = 'dateA'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2095 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2096 |  |  |         if ($orderby === 'hits ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2097 |  |  |             $orderby = 'hitsA'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2098 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2099 |  |  |         if ($orderby === 'rating ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2100 |  |  |             $orderby = 'ratingA'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2101 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2102 |  |  |         if ($orderby === 'country ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2103 |  |  |             $orderby = 'countryA'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2104 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2105 |  |  |         if ($orderby === 'weight ASC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2106 |  |  |             $orderby = 'weightA'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2107 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2108 |  |  |         if ($orderby === 'title DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2109 |  |  |             $orderby = 'titleD'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2110 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2111 |  |  |         if ($orderby === 'published DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2112 |  |  |             $orderby = 'dateD'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2113 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2114 |  |  |         if ($orderby === 'hits DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2115 |  |  |             $orderby = 'hitsD'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2116 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2117 |  |  |         if ($orderby === 'rating DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2118 |  |  |             $orderby = 'ratingD'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2119 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2120 |  |  |         if ($orderby === 'country DESC') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2121 |  |  |             $orderby = 'countryD'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2122 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2124 |  |  |         return $orderby; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2125 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 2126 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 2127 |  |  |  | 
            
                        
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.