| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Module: SmartRental | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Author: The SmartFactory <www.smartfactory.ca> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * Licence: GNU | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @param $cssfile | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | function smart_get_css_link($cssfile) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '" />'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | function smart_get_page_before_form() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     global $smart_previous_page; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     return isset($_POST['smart_page_before_form']) ? $_POST['smart_page_before_form'] : $smart_previous_page; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * Checks if a user is admin of $module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * @param  bool  $module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  * @return bool: true if user is admin | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | function smart_userIsAdmin($module = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     global $xoopsUser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     static $smart_isAdmin; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     if (!$module) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $module = $xoopsModule->getVar('dirname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     if (isset($smart_isAdmin[$module])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         return $smart_isAdmin[$module]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     if (!$xoopsUser) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         $smart_isAdmin[$module] = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         return $smart_isAdmin[$module]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     $smart_isAdmin[$module] = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     $smartModule            = smart_getModuleInfo($module); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     if (!is_object($smartModule)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     $module_id              = $smartModule->getVar('mid'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     $smart_isAdmin[$module] = $xoopsUser->isAdmin($module_id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     return $smart_isAdmin[$module]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | function smart_isXoops22() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     $xoops22 = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     $xv      = str_replace('XOOPS ', '', XOOPS_VERSION); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     if (substr($xv, 2, 1) == '2') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $xoops22 = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     return $xoops22; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  * @param  bool   $withLink | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  * @param  bool   $forBreadCrumb | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |  * @param  bool   $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | function smart_getModuleName($withLink = true, $forBreadCrumb = false, $moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     if (!$moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $moduleName = $xoopsModule->getVar('dirname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     $smartModule       = smart_getModuleInfo($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     $smartModuleConfig = smart_getModuleConfig($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     if (!isset($smartModule)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     if ($forBreadCrumb && (isset($smartModuleConfig['show_mod_name_breadcrumb']) && !$smartModuleConfig['show_mod_name_breadcrumb'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |     if (!$withLink) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         return $smartModule->getVar('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         $seoMode = smart_getModuleModeSEO($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         if ($seoMode === 'rewrite') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             $seoModuleName = smart_getModuleNameForSEO($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             $ret           = XOOPS_URL . '/' . $seoModuleName . '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         } elseif ($seoMode === 'pathinfo') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |             $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |             $ret = XOOPS_URL . '/modules/' . $moduleName . '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  * @param  bool   $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | function smart_getModuleNameForSEO($moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     $smartModule       = smart_getModuleInfo($moduleName); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     $smartModuleConfig = smart_getModuleConfig($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     if (isset($smartModuleConfig['seo_module_name'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         return $smartModuleConfig['seo_module_name']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     $ret = smart_getModuleName(false, false, $moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     return strtolower($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  * @param  bool $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | function smart_getModuleModeSEO($moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     $smartModule       = smart_getModuleInfo($moduleName); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     $smartModuleConfig = smart_getModuleConfig($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     return isset($smartModuleConfig['seo_mode']) ? $smartModuleConfig['seo_mode'] : false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  * @param  bool $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | function smart_getModuleIncludeIdSEO($moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     $smartModule       = smart_getModuleInfo($moduleName); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |     $smartModuleConfig = smart_getModuleConfig($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |     return !empty($smartModuleConfig['seo_inc_id']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  * @param $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | function smart_getenv($key) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     $ret = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     $ret = isset($_SERVER[$key]) ? $_SERVER[$key] : (isset($_ENV[$key]) ? $_ENV[$key] : ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | function smart_xoops_cp_header() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     xoops_cp_header(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |     global $xoopsModule, $xoopsConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |      * include SmartObject admin language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |     $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 174 |  | View Code Duplication |     if (file_exists($fileName)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         include_once $fileName; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |     ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     <script type='text/javascript'> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |         <!-- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |         var smart_url = '<?php echo SMARTOBJECT_URL ?>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         var smart_modulename = '<?php echo $xoopsModule->getVar('dirname') ?>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |         // --> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |     <script | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         type='text/javascript' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         src='<?php echo SMARTOBJECT_URL ?>include/smart.js'></script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |     <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |      * Include the admin language constants for the SmartObject Framework | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     $admin_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/admin.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     if (!file_exists($admin_file)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         $admin_file = SMARTOBJECT_ROOT_PATH . 'language/english/admin.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |     include_once($admin_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |  * Detemines if a table exists in the current db | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  * @param  string $table the table name (without XOOPS prefix) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |  * @return bool   True if table exists, false if not | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  * @author xhelp development team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | function smart_TableExists($table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     $bRetVal = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     //Verifies that a MySQL table exists | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     $xoopsDB  = XoopsDatabaseFactory::getDatabaseConnection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     $realname = $xoopsDB->prefix($table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     $ret      = $xoopsDB->queryF($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |     while (list($m_table) = $xoopsDB->fetchRow($ret)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         if ($m_table == $realname) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |             $bRetVal = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |             break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |     $xoopsDB->freeRecordSet($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |     return $bRetVal; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |  * Gets a value from a key in the xhelp_meta table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  * @param  string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  * @param  bool   $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |  * @return string $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |  * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |  * @author xhelp development team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | function smart_GetMeta($key, $moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |     if (!$moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         $moduleName = smart_getCurrentModuleName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |     $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     $sql     = sprintf('SELECT metavalue FROM %s WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     $ret     = $xoopsDB->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |     if (!$ret) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |         $value = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |         list($value) = $xoopsDB->fetchRow($ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     return $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | function smart_getCurrentModuleName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |     global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     if (is_object($xoopsModule)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |         return $xoopsModule->getVar('dirname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |  * Sets a value for a key in the xhelp_meta table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  * @param  string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  * @param  string $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  * @param  bool   $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |  * @return bool   TRUE if success, FALSE if failure | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  * @access public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  * @author xhelp development team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | function smart_SetMeta($key, $value, $moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |     if (!$moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |         $moduleName = smart_getCurrentModuleName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |     $ret     = smart_GetMeta($key, $moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |     if ($ret === '0' || $ret > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |         $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |         $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |     $ret = $xoopsDB->queryF($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |     if (!$ret) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |     return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  | // Thanks to Mithrandir:-) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |  * @param         $str | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |  * @param         $start | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  * @param         $length | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |  * @param  string $trimmarker | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  | function smart_substr($str, $start, $length, $trimmarker = '...') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |     // if the string is empty, let's get out ;-) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |     if ($str === '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |         return $str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     // reverse a string that is shortened with '' as trimmarker | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |     $reversed_string = strrev(xoops_substr($str, $start, $length, '')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |     // find first space in reversed string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     $position_of_space = strpos($reversed_string, ' ', 0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |     // truncate the original string to a length of $length | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |     // minus the position of the last space | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |     // plus the length of the $trimmarker | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |     $truncated_string = xoops_substr($str, $start, $length - $position_of_space + strlen($trimmarker), $trimmarker); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |     return $truncated_string; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |  * @param              $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |  * @param  bool        $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  * @param  string      $default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |  * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  | function smart_getConfig($key, $moduleName = false, $default = 'default_is_undefined') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     if (!$moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |         $moduleName = smart_getCurrentModuleName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     $configs = smart_getModuleConfig($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |     if (isset($configs[$key])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |         return $configs[$key]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |         if ($default === 'default_is_undefined') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |             return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |             return $default; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |  * Copy a file, or a folder and its contents | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |  * @author      Aidan Lister <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  * @param  string $source The source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |  * @param  string $dest   The destination | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |  * @return bool   Returns true on success, false on failure | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  | function smart_copyr($source, $dest) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |     // Simple copy for a file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |     if (is_file($source)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |         return copy($source, $dest); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |     // Make destination directory | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     if (!is_dir($dest)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |         mkdir($dest); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |     // Loop through the folder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |     $dir = dir($source); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |     while (false !== $entry = $dir->read()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |         // Skip pointers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |         if ($entry === '.' || $entry === '..') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |             continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |         // Deep copy directories | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         if (is_dir("$source/$entry") && ($dest !== "$source/$entry")) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |             copyr("$source/$entry", "$dest/$entry"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |             copy("$source/$entry", "$dest/$entry"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |     // Clean up | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |     $dir->close(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |     return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |  * Thanks to the NewBB2 Development Team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |  * @param $target | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  | function smart_admin_mkdir($target) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |     // http://www.php.net/manual/en/function.mkdir.php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |     // saint at corenova.com | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     // bart at cdasites dot com | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |     if (is_dir($target) || empty($target)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |         return true; // best case check first | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |     if (file_exists($target) && !is_dir($target)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     if (smart_admin_mkdir(substr($target, 0, strrpos($target, '/')))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         if (!file_exists($target)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |             $res = mkdir($target, 0777); // crawl back up & create dir tree | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |             smart_admin_chmod($target); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |             return $res; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |     $res = is_dir($target); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |     return $res; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |  * Thanks to the NewBB2 Development Team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |  * @param       $target | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |  * @param  int  $mode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  | function smart_admin_chmod($target, $mode = 0777) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |     return @ chmod($target, $mode); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |  * @param $src | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |  * @param $maxWidth | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |  * @param $maxHeight | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |  * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  | function smart_imageResize($src, $maxWidth, $maxHeight) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |     $width  = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |     $height = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |     $type   = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |     $attr   = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |     if (file_exists($src)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         list($width, $height, $type, $attr) = getimagesize($src); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |         if ($width > $maxWidth) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |             $originalWidth = $width; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |             $width         = $maxWidth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |             $height        = $width * $height / $originalWidth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |         if ($height > $maxHeight) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |             $originalHeight = $height; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |             $height         = $maxHeight; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |             $width          = $height * $width / $originalHeight; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |         $attr = " width='$width' height='$height'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |     return array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |         $width, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |         $height, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |         $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |         $attr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |  * @param  bool  $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  | function smart_getModuleInfo($moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |     static $smartModules; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |     if (isset($smartModules[$moduleName])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |         $ret =& $smartModules[$moduleName]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |     global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |     if (!$moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |         if (isset($xoopsModule) && is_object($xoopsModule)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |             $smartModules[$xoopsModule->getVar('dirname')] = $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |             return $smartModules[$xoopsModule->getVar('dirname')]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |     if (!isset($smartModules[$moduleName])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |         if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |             $smartModules[$moduleName] = $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |             $hModule = xoops_getHandler('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |             if ($moduleName !== 'xoops') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |                 $smartModules[$moduleName] = $hModule->getByDirname($moduleName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |                 $smartModules[$moduleName] = $hModule->getByDirname('system'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |     return $smartModules[$moduleName]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |  * @param  bool $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |  * @return bool | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 502 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 503 |  |  | function smart_getModuleConfig($moduleName = false) | 
            
                                                                        
                            
            
                                    
            
            
                | 504 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 505 |  |  |     static $smartConfigs; | 
            
                                                                        
                            
            
                                    
            
            
                | 506 |  |  |     if (isset($smartConfigs[$moduleName])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 507 |  |  |         $ret =& $smartConfigs[$moduleName]; | 
            
                                                                        
                            
            
                                    
            
            
                | 508 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 509 |  |  |         return $ret; | 
            
                                                                        
                            
            
                                    
            
            
                | 510 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 511 |  |  |     global $xoopsModule, $xoopsModuleConfig; | 
            
                                                                        
                            
            
                                    
            
            
                | 512 |  |  |     if (!$moduleName) { | 
            
                                                                        
                            
            
                                    
            
            
                | 513 |  |  |         if (isset($xoopsModule) && is_object($xoopsModule)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 514 |  |  |             $smartConfigs[$xoopsModule->getVar('dirname')] = $xoopsModuleConfig; | 
            
                                                                        
                            
            
                                    
            
            
                | 515 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 516 |  |  |             return $smartConfigs[$xoopsModule->getVar('dirname')]; | 
            
                                                                        
                            
            
                                    
            
            
                | 517 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 518 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 519 |  |  |     // if we still did not found the xoopsModule, this is because there is none | 
            
                                                                        
                            
            
                                    
            
            
                | 520 |  |  |     if (!$moduleName) { | 
            
                                                                        
                            
            
                                    
            
            
                | 521 |  |  |         $ret = false; | 
            
                                                                        
                            
            
                                    
            
            
                | 522 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 523 |  |  |         return $ret; | 
            
                                                                        
                            
            
                                    
            
            
                | 524 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 525 |  |  |     if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) { | 
            
                                                                        
                            
            
                                    
            
            
                | 526 |  |  |         $smartConfigs[$moduleName] = $xoopsModuleConfig; | 
            
                                                                        
                            
            
                                    
            
            
                | 527 |  |  |     } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 528 |  |  |         $module = smart_getModuleInfo($moduleName); | 
            
                                                                        
                            
            
                                    
            
            
                | 529 |  |  |         if (!is_object($module)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 530 |  |  |             $ret = false; | 
            
                                                                        
                            
            
                                    
            
            
                | 531 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 532 |  |  |             return $ret; | 
            
                                                                        
                            
            
                                    
            
            
                | 533 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 534 |  |  |         $hModConfig                = xoops_getHandler('config'); | 
            
                                                                        
                            
            
                                    
            
            
                | 535 |  |  |         $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid')); | 
            
                                                                        
                            
            
                                    
            
            
                | 536 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 537 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 538 |  |  |     return $smartConfigs[$moduleName]; | 
            
                                                                        
                            
            
                                    
            
            
                | 539 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |  * @param $dirname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |  * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  | function smart_deleteFile($dirname) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |     // Simple delete for a file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |     if (is_file($dirname)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |         return unlink($dirname); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |  * @param  array  $errors | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  | function smart_formatErrors($errors = array()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |     $ret = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |     foreach ($errors as $key => $value) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |         $ret .= '<br> - ' . $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |  * smart_getLinkedUnameFromId() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |  * @param  integer $userid      Userid of poster etc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |  * @param  integer $name        :  0 Use Usenamer 1 Use realname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |  * @param  array   $users | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |  * @param  bool    $withContact | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  | function smart_getLinkedUnameFromId($userid = 0, $name = 0, $users = array(), $withContact = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |     if (!is_numeric($userid)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |         return $userid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |     $userid = (int)$userid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |     if ($userid > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |         if ($users == array()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |             //fetching users | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |             $memberHandler = xoops_getHandler('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |             $user          =& $memberHandler->getUser($userid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |             if (!isset($users[$userid])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |                 return $GLOBALS['xoopsConfig']['anonymous']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |             $user =& $users[$userid]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |         if (is_object($user)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |             $ts        = MyTextSanitizer:: getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |             $username  = $user->getVar('uname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |             $fullname  = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |             $fullname2 = $user->getVar('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |             if ($name && !empty($fullname2)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |                 $fullname = $user->getVar('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |             if (!empty($fullname)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |                 $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |                 $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |             // add contact info: email + PM | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |             if ($withContact) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |                 $linkeduser .= ' <a href="mailto:' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |                                $user->getVar('email') . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |                                '"><img style="vertical-align: middle;" src="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |                                XOOPS_URL . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |                                '/images/icons/email.gif' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |                                '" alt="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |                                _CO_SOBJECT_SEND_EMAIL . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |                                '" title="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |                                _CO_SOBJECT_SEND_EMAIL . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |                                '"/></a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |                 $js = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |                 $linkeduser .= ' <a href="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |                                $js . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |                                '"><img style="vertical-align: middle;" src="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |                                XOOPS_URL . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |                                '/images/icons/pm.gif' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |                                '" alt="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |                                _CO_SOBJECT_SEND_PM . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |                                '" title="' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |                                _CO_SOBJECT_SEND_PM . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |                                '"/></a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |             return $linkeduser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |     return $GLOBALS['xoopsConfig']['anonymous']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |  * @param int    $currentoption | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |  * @param string $breadcrumb | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |  * @param bool   $submenus | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |  * @param int    $currentsub | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  | function smart_adminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |     global $xoopsModule, $xoopsConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |     include_once XOOPS_ROOT_PATH . '/class/template.php'; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 648 |  | View Code Duplication |     if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |         include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |         include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |     } | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 653 |  | View Code Duplication |     if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php')) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |         include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |         include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |     $headermenu = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |     $adminmenu  = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |     include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |     $tpl = new XoopsTpl(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |     $tpl->assign(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |                      'headermenu'      => $headermenu, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |                      'adminmenu'       => $adminmenu, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |                      'current'         => $currentoption, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |                      'breadcrumb'      => $breadcrumb, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |                      'headermenucount' => count($headermenu), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |                      'submenus'        => $submenus, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |                      'currentsub'      => $currentsub, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |                      'submenuscount'   => count($submenus) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |                  )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |     $tpl->display('db:smartobject_admin_menu.tpl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |  * @param string $id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |  * @param string $title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |  * @param string $dsc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |  */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 680 |  | View Code Duplication | function smart_collapsableBar($id = '', $title = '', $dsc = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |     global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |     echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |     echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt='' /></a> " . $title . '</h3>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |     echo "<div id='" . $id . "'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |     if ($dsc !== '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |         echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |  * @param string $id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |  * @param string $title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |  * @param string $dsc | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |  */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 696 |  | View Code Duplication | function smart_ajaxCollapsableBar($id = '', $title = '', $dsc = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  |     global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  |     $onClick = "ajaxtogglecollapse('$id')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  |     //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |     echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |     echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt='' /></a> " . $title . '</h3>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  |     echo "<div id='" . $id . "'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |     if ($dsc !== '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |         echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |  * Ajax testing...... | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  |  * @param $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  | /* | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  |  function smart_collapsableBar($id = '', $title = '', $dsc='') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |  { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |  global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |  //echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"toggle('" . $id . "'); toggleIcon('" . $id . "_icon')\";>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |  ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |  <h3 class="smart_collapsable_title"><a href="javascript:Effect.Combo('<?php echo $id ?>');"><?php echo $title ?></a></h3> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  |  <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |  echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt='' /></a> " . $title . "</h3>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |  echo "<div id='" . $id . "'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |  if ($dsc != '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |  echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . "</span>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |  } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |  } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  | function smart_openclose_collapsable($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |     $urls        = smart_getCurrentUrls(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |     $path        = $urls['phpself']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |     $cookie_name = $path . '_smart_collaps_' . $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |     $cookie_name = str_replace('.', '_', $cookie_name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |     $cookie      = smart_getCookieVar($cookie_name, ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |     if ($cookie === 'none') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |         echo ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |                 <script type="text/javascript"><!-- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |                 togglecollapse("' . $name . '"); toggleIcon("' . $name . '_icon"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |                     //--> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |                 </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |                 '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |     /*  if ($cookie == 'none') { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |      echo ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |      <script type="text/javascript"><!-- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |      hideElement("' . $name . '"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |      //--> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |      </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |      '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |      } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |  * @param $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  | function smart_close_collapsable($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |     echo '</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |     smart_openclose_collapsable($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  |     echo '<br>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |  * @param     $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  |  * @param     $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  |  * @param int $time | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  | function smart_setCookieVar($name, $value, $time = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |     if ($time == 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |         $time = time() + 3600 * 24 * 365; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  |         //$time = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |     setcookie($name, $value, $time, '/'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |  * @param         $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  |  * @param  string $default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  | function smart_getCookieVar($name, $default = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 |  |  |     $name = str_replace('.', '_', $name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  |     if (isset($_COOKIE[$name]) && ($_COOKIE[$name] > '')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  |         return $_COOKIE[$name]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  |         return $default; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |  * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  | function smart_getCurrentUrls() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  |     $urls        = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  |     $http        = (strpos(XOOPS_URL, 'https://') === false) ? 'http://' : 'https://'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  |     $phpself     = $_SERVER['PHP_SELF']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  |     $httphost    = $_SERVER['HTTP_HOST']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  |     $querystring = $_SERVER['QUERY_STRING']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |     if ($querystring !== '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  |         $querystring = '?' . $querystring; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  |     $currenturl           = $http . $httphost . $phpself . $querystring; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  |     $urls                 = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  |     $urls['http']         = $http; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |     $urls['httphost']     = $httphost; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |     $urls['phpself']      = $phpself; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |     $urls['querystring']  = $querystring; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |     $urls['full_phpself'] = $http . $httphost . $phpself; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |     $urls['full']         = $currenturl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  |     $urls['isHomePage']   = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |     return $urls; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  | function smart_getCurrentPage() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  |     $urls = smart_getCurrentUrls(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  |     return $urls['full']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |  * Create a title for the short_url field of an article | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |  * @credit psylove | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |  * @var    string $title   title of the article | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |  * @var    string $withExt do we add an html extension or not | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |  * @return string sort_url for the article | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |  * Moved in SmartMetaGenClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  | /* | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  |  function smart_seo_title($title='', $withExt=true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  |  { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  |  // Transformation de la chaine en minuscule | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |  // Codage de la chaine afin d'�viter les erreurs 500 en cas de caract�res impr�vus | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |  $title   = rawurlencode(strtolower($title)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |  // Transformation des ponctuations | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |  //                 Tab     Space      !        "        #        %        &        '        (        )        ,        /       :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |  $pattern = array("/%09/", "/%20/", "/%21/", "/%22/", "/%23/", "/%25/", "/%26/", "/%27/", "/%28/", "/%29/", "/%2C/", "/%2F/", "/%3A/", "/%3B/", "/%3C/", "/%3D/", "/%3E/", "/%3F/", "/%40/", "/%5B/", "/%5C/", "/%5D/", "/%5E/", "/%7B/", "/%7C/", "/%7D/", "/%7E/", "/\./"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |  $rep_pat = array(  "-"  ,   "-"  ,   ""   ,   ""   ,   ""   , "-100" ,   ""   ,   "-"  ,   ""   ,   ""   ,   ""   ,   "-"  ,   ""   ,   ""   ,   ""   ,   "-"  ,   ""   ,   ""   , "-at-" ,   ""   ,   "-"   ,  ""   ,   "-"  ,   ""   ,   "-"  ,   ""   ,   "-"  ,  ""  ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |  $title   = preg_replace($pattern, $rep_pat, $title); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |  // Transformation des caract�res accentu�s | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  |     $pattern = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  |         '/%B0/', // ° | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |         '/%E8/', // è | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  |         '/%E9/', // é | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |         '/%EA/', // ê | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |         '/%EB/', // ë | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  |         '/%E7/', // ç | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |         '/%E0/', // à | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |         '/%E2/', // â | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  |         '/%E4/', // ä | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |         '/%EE/', // î | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |         '/%EF/', // ï | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |         '/%F9/', // ù | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |         '/%FC/', // ü | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 |  |  |         '/%FB/', // û | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |         '/%F4/', // ô | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |         '/%F6/', // ö | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |  $rep_pat = array(  "e"  ,   "e"  ,   "e"  ,   "e"  ,   "c"  ,   "a"  ,   "a"  ,   "a"  ,   "i"  ,   "i"  ,   "u"  ,   "u"  ,   "u"  ,   "o"  ,   "o"  ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |  $title   = preg_replace($pattern, $rep_pat, $title); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |  if (count($title) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |  if ($withExt) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  |  $title .= '.html'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |  } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  |  return $title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |  } else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |  return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  |  } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  | function smart_modFooter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |     global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |     include_once XOOPS_ROOT_PATH . '/class/template.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |     $tpl = new XoopsTpl(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |     $hModule      = xoops_getHandler('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  |     $versioninfo  =& $hModule->get($xoopsModule->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  |     $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |     $modfooter    = "<a href='" . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |                     $versioninfo->getInfo('support_site_url') . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |                     "' target='_blank'><img src='" . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |                     XOOPS_URL . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |                     '/modules/' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |                     $xoopsModule->getVar('dirname') . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  |                     "/assets/images/cssbutton.gif' title='" . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |                     $modfootertxt . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  |                     "' alt='" . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |                     $modfootertxt . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |                     "'/></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |     $tpl->assign('modfooter', $modfooter); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |     if (!defined('_AM_SOBJECT_XOOPS_PRO')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  |         define('_AM_SOBJECT_XOOPS_PRO', 'Do you need help with this module ?<br>Do you need new features not yet available?'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  |     $smartobjectConfig = smart_getModuleConfig('smartobject'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |     $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |     $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.html'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  | function smart_xoops_cp_footer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  |     smart_modFooter(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  |     xoops_cp_footer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |  * @param $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  | function smart_sanitizeForCommonTags($text) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |     global $xoopsConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |     $text = str_replace('{X_SITENAME}', $xoopsConfig['sitename'], $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |     $text = str_replace('{X_ADMINMAIL}', $xoopsConfig['adminmail'], $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |     return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |  * @param $src | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  | function smart_addScript($src) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |     echo '<script src="' . $src . '" type="text/javascript"></script>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |  * @param $src | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  | function smart_addStyle($src) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  |     if ($src === 'smartobject') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  |         $src = SMARTOBJECT_URL . 'assets/css/module.css'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |     echo smart_get_css_link($src); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  | function smart_addAdminAjaxSupport() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |     smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  |     smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  |     smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  |  * @param $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  | function smart_sanitizeForSmartpopupLink($text) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  |     $patterns[]     = "/\[smartpopup=(['\"]?)([^\"'<>]*)\\1](.*)\[\/smartpopup\]/sU"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 |  |  |     $replacements[] = "<a href=\"javascript:openWithSelfMain('\\2', 'smartpopup', 700, 519);\">\\3</a>"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 |  |  |     $ret            = preg_replace($patterns, $replacements, $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  |  * Finds the width and height of an image (can also be a flash file) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  |  * @credit phppp | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  |  * @var    string $url    path of the image file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 |  |  |  * @var    string $width  reference to the width | 
            
                                                                                                            
                            
            
                                    
            
            
                | 986 |  |  |  * @var    string $height reference to the height | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 |  |  |  * @return bool   false if impossible to find dimension | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 |  |  | function smart_getImageSize($url, & $width, & $height) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  |     if (empty($width) || empty($height)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  |         if (!$dimension = @ getimagesize($url)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 |  |  |         if (!empty($width)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 |  |  |             $height = $dimension[1] * $width / $dimension[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 |  |  |         } elseif (!empty($height)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  |             $width = $dimension[0] * $height / $dimension[1]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  |             list($width, $height) = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 |  |  |                 $dimension[0], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  |                 $dimension[1] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1010 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  |  * Convert characters to decimal values | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 |  |  |  * @author eric.wallet at yahoo.fr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  |  * @link   http://ca.php.net/manual/en/function.htmlentities.php#69913 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 |  |  |  * @param $str | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  | function smart_htmlnumericentities($str) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  |     //    return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 |  |  |     return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) { return '&#' . ord($m[0]) . chr(59); }, $str); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  |  * @param        $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  |  * @param  bool  $optional | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 |  |  | function smart_getcorehandler($name, $optional = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 |  |  |     static $handlers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  |     $name = strtolower(trim($name)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  |     if (!isset($handlers[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  |         if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  |             require_once $hnd_file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  |         $class = 'Xoops' . ucfirst($name) . 'Handler'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  |         if (class_exists($class)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  |             $handlers[$name] = new $class ($GLOBALS['xoopsDB'], 'xoops'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  |     if (!isset($handlers[$name]) && !$optional) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  |         trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 |  |  |     if (isset($handlers[$name])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  |         return $handlers[$name]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  |     $inst = false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  |  * @param $matches | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  | function smart_sanitizeAdsenses_callback($matches) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  |     global $smartobjectAdsenseHandler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  |     if (isset($smartobjectAdsenseHandler->objects[$matches[1]])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  |         $adsenseObj = $smartobjectAdsenseHandler->objects[$matches[1]]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  |         $ret        = $adsenseObj->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  |         return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  |  * @param $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  | function smart_sanitizeAdsenses($text) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  |     $patterns     = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  |     $replacements = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  |     $patterns[] = "/\[adsense](.*)\[\/adsense\]/sU"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  |     $text       = preg_replace_callback($patterns, 'smart_sanitizeAdsenses_callback', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  |     return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 |  |  |  * @param $matches | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  | function smart_sanitizeCustomtags_callback($matches) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1090 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1091 |  |  |     global $smartobjectCustomtagHandler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1092 |  |  |     if (isset($smartobjectCustomtagHandler->objects[$matches[1]])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1093 |  |  |         $customObj = $smartobjectCustomtagHandler->objects[$matches[1]]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 |  |  |         $ret       = $customObj->renderWithPhp(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  |         return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  |  * @param $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  | function smart_sanitizeCustomtags($text) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  |     $patterns     = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  |     $replacements = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  |     $patterns[] = "/\[customtag](.*)\[\/customtag\]/sU"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  |     $text       = preg_replace_callback($patterns, 'smart_sanitizeCustomtags_callback', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  |     return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  |  * @param $module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  |  * @param $file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 |  |  | function smart_loadLanguageFile($module, $file) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  |     global $xoopsConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  |     $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  |     if (!file_exists($filename)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  |         $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  |     if (file_exists($filename)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  |         include_once($filename); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  | function smart_loadCommonLanguageFile() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 |  |  |     smart_loadLanguageFile('smartobject', 'common'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  |  * @param               $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  |  * @param  bool         $keyword | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 |  |  |  * @return mixed|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  | function smart_purifyText($text, $keyword = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 |  |  |     global $myts; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 |  |  |     $text = str_replace(' ', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  |     $text = str_replace('<br>', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  |     $text = str_replace('<br>', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  |     $text = str_replace('<br', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 |  |  |     $text = strip_tags($text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  |     $text = html_entity_decode($text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  |     $text = $myts->undoHtmlSpecialChars($text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  |     $text = str_replace(')', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  |     $text = str_replace('(', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  |     $text = str_replace(':', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 |  |  |     $text = str_replace('&euro', ' euro ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  |     $text = str_replace('&hellip', '...', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 |  |  |     $text = str_replace('&rsquo', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  |     $text = str_replace('!', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 |  |  |     $text = str_replace('?', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  |     $text = str_replace('"', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  |     $text = str_replace('-', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  |     $text = str_replace('\n', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  |     $text = str_replace('―', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 |  |  |     if ($keyword) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  |         $text = str_replace('.', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 |  |  |         $text = str_replace(',', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  |         $text = str_replace('\'', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  |     $text = str_replace(';', ' ', $text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  |     return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  |  * @param $document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  |  * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  | function smart_html2text($document) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  |     // PHP Manual:: function preg_replace | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  |     // $document should contain an HTML document. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |     // This will remove HTML tags, javascript sections | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  |     // and white space. It will also convert some | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1187 |  |  |     // common HTML entities to their text equivalent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1188 |  |  |     // Credits: newbb2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1189 |  |  |     $search = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1190 |  |  |         "'<script[^>]*?>.*?</script>'si",  // Strip out javascript | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1191 |  |  |         "'<img.*?/>'si",       // Strip out img tags | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1192 |  |  |         "'<[\/\!]*?[^<>]*?>'si",          // Strip out HTML tags | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1193 |  |  |         "'([\r\n])[\s]+'",                // Strip out white space | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1194 |  |  |         "'&(quot|#34);'i",                // Replace HTML entities | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1195 |  |  |         "'&(amp|#38);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1196 |  |  |         "'&(lt|#60);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1197 |  |  |         "'&(gt|#62);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1198 |  |  |         "'&(nbsp|#160);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1199 |  |  |         "'&(iexcl|#161);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1200 |  |  |         "'&(cent|#162);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1201 |  |  |         "'&(pound|#163);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1202 |  |  |         "'&(copy|#169);'i", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1203 |  |  |         "'&#(\d+);'e" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1204 |  |  |     );                    // evaluate as php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1206 |  |  |     $replace = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1207 |  |  |         '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1208 |  |  |         '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1209 |  |  |         '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1210 |  |  |         "\\1", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1211 |  |  |         "\"", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1212 |  |  |         '&', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1213 |  |  |         '<', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1214 |  |  |         '>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1215 |  |  |         ' ', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1216 |  |  |         chr(161), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1217 |  |  |         chr(162), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1218 |  |  |         chr(163), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1219 |  |  |         chr(169), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1220 |  |  |         "chr(\\1)" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1221 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1223 |  |  |     $text = preg_replace($search, $replace, $document); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1225 |  |  |     return $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1226 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1228 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1229 |  |  |  * @author pillepop2003 at yahoo dot de | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1230 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1231 |  |  |  * Use this snippet to extract any float out of a string. You can choose how a single dot is treated with the (bool) 'single_dot_as_decimal' directive. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1232 |  |  |  * This function should be able to cover almost all floats that appear in an european environment. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1233 |  |  |  * @param            $str | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1234 |  |  |  * @param  bool      $set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1235 |  |  |  * @return float|int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1236 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1237 |  |  | function smart_getfloat($str, $set = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1238 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1239 |  |  |     if (preg_match("/([0-9\.,-]+)/", $str, $match)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1240 |  |  |         // Found number in $str, so set $str that number | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1241 |  |  |         $str = $match[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1242 |  |  |         if (false !== strpos($str, ',')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1243 |  |  |             // A comma exists, that makes it easy, cos we assume it separates the decimal part. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1244 |  |  |             $str = str_replace('.', '', $str);    // Erase thousand seps | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1245 |  |  |             $str = str_replace(',', '.', $str);    // Convert , to . for floatval command | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1247 |  |  |             return (float)$str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1248 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1249 |  |  |             // No comma exists, so we have to decide, how a single dot shall be treated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1250 |  |  |             if (preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) == true && $set['single_dot_as_decimal'] == true) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1251 |  |  |                 // Treat single dot as decimal separator | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1252 |  |  |                 return (float)$str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1253 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1254 |  |  |                 //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> "; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1255 |  |  |                 // Else, treat all dots as thousand seps | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1256 |  |  |                 $str = str_replace('.', '', $str);    // Erase thousand seps | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1258 |  |  |                 return (float)$str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1259 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1260 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1261 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1262 |  |  |         // No number found, return zero | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1263 |  |  |         return 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1264 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1265 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1266 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1267 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1268 |  |  |  * @param                         $var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1269 |  |  |  * @param  bool                   $currencyObj | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1270 |  |  |  * @return float|int|mixed|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1271 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1272 |  |  | function smart_currency($var, $currencyObj = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1273 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1274 |  |  |     $ret = smart_getfloat($var, array('single_dot_as_decimal' => true)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1275 |  |  |     $ret = round($ret, 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1276 |  |  |     // make sur we have at least .00 in the $var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1277 |  |  |     $decimal_section_original = strstr($ret, '.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1278 |  |  |     $decimal_section          = $decimal_section_original; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1279 |  | View Code Duplication |     if ($decimal_section) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1280 |  |  |         if (strlen($decimal_section) == 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1281 |  |  |             $decimal_section = '.00'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1282 |  |  |         } elseif (strlen($decimal_section) == 2) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1283 |  |  |             $decimal_section .= '0'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1284 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1285 |  |  |         $ret = str_replace($decimal_section_original, $decimal_section, $ret); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1286 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1287 |  |  |         $ret .= '.00'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1288 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1289 |  |  |     if ($currencyObj) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1290 |  |  |         $ret = $ret . ' ' . $currencyObj->getCode(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1291 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1293 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1294 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1296 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1297 |  |  |  * @param $var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1298 |  |  |  * @return float|int|mixed|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1299 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1300 |  |  | function smart_float($var) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1301 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1302 |  |  |     return smart_currency($var); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1303 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1304 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1305 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1306 |  |  |  * @param  bool   $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1307 |  |  |  * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1308 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1309 |  |  | function smart_getModuleAdminLink($moduleName = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1310 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1311 |  |  |     global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1312 |  |  |     if (!$moduleName && (isset($xoopsModule) && is_object($xoopsModule))) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1313 |  |  |         $moduleName = $xoopsModule->getVar('dirname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1314 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1315 |  |  |     $ret = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1316 |  |  |     if ($moduleName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1317 |  |  |         $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1318 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1319 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1320 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1321 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1322 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1323 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1324 |  |  |  * @return array|bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1325 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1326 |  |  | function smart_getEditors() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1327 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1328 |  |  |     $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1329 |  |  |     if (!file_exists($filename)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1330 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1331 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1332 |  |  |     include_once $filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1333 |  |  |     $xoopseditorHandler = XoopsEditorHandler::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1334 |  |  |     $aList              = $xoopseditorHandler->getList(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1335 |  |  |     $ret                = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1336 |  |  |     foreach ($aList as $k => $v) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1337 |  |  |         $ret[$v] = $k; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1338 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1339 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1340 |  |  |     return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1341 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1343 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1344 |  |  |  * @param $moduleName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1345 |  |  |  * @param $items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1346 |  |  |  * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1347 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1348 |  |  | function smart_getTablesArray($moduleName, $items) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1349 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1350 |  |  |     $ret = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1351 |  |  |     foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1352 |  |  |         $ret[] = $moduleName . '_' . $item; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1353 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1354 |  |  |     $ret[] = $moduleName . '_meta'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1355 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1356 |  |  |     return $ret; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1357 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 1358 |  |  |  | 
            
                        
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.