Changeset 757 for branches/Ver3.0/xpressme_integration_kit/class
- Timestamp:
- May 23, 2011, 3:03:57 PM (13 years ago)
- Location:
- branches/Ver3.0/xpressme_integration_kit/class
- Files:
-
- 1 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Ver3.0/xpressme_integration_kit/class/modInfo_class.php
r755 r757 9 9 */ 10 10 11 /* 12 * The function to acquire only a set value without calling the XOOPS system is here. 13 */ 14 15 class modInfo{ 11 if (defined( 'XOOPS_MAINFILE_INCLUDED')) : 12 13 class modInfoClass { 16 14 var $xoops_mainfile_path; 17 15 var $xoops_root_path; … … 27 25 var $xoops_language; 28 26 var $module_db_prefix; 29 var $db_name;30 var $db_user;31 var $db_pass;32 var $db_host;33 27 var $module_name; 34 28 var $module_path; … … 37 31 var $module_codename; 38 32 var $module_id; 39 var $is_impress; 33 var $xoops_version; 34 var $is_impress_cms; 35 var $is_cube_legacy; 36 var $is_xoops2jp; 37 var $is_xoops2; 38 var $is_xoops_legacy; 39 var $is_jpex; 40 40 var $xoops_time_zone; 41 var $wp_version; 42 var $wpConfigInfo; 41 43 42 44 function __constructor() //for PHP5 43 45 { 44 $this-> xpressInfo();46 $this->modInfoClass(); 45 47 46 48 } 47 49 48 function modInfo () //for PHP4 constructor50 function modInfoClass() //for PHP4 constructor 49 51 { 50 global $xoopsModule ;51 52 $this->xoops_mainfile_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php';53 $this->module_path=dirname(dirname(__FILE__));54 $this->module_name=basename($this->module_path);52 global $xoopsModule,$wpConfigInfo; 53 if (is_object($wpConfigInfo)){ 54 include_once dirname(__FILE__).'/wpConfigInfo_class.php'; 55 $this->wpConfigInfo = new wpConfigInfoClass; 56 } 55 57 $this->xoops_root_path = XOOPS_ROOT_PATH; 56 58 $this->xoops_trust_path = (defined('XOOPS_TRUST_PATH')) ? XOOPS_TRUST_PATH : ''; 57 59 $this->xoops_url = XOOPS_URL; 58 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name;60 $this->xoops_mainfile_path = XOOPS_ROOT_PATH . '/mainfile.php'; 59 61 $this->xoops_upload_path = XOOPS_UPLOAD_PATH; 60 62 $this->xoops_upload_url = XOOPS_UPLOAD_URL; 61 63 $this->xoops_cache_path = XOOPS_CACHE_PATH; 62 $this->db_prefix = XOOPS_DB_PREFIX; 63 $this->module_db_prefix = $this->xoops_db_prefix . '_' . preg_replace('/wordpress/','wp',$this->module_name) . '_'; 64 $this->db_name = XOOPS_DB_NAME; 65 $this->db_user = XOOPS_DB_USER; 66 $this->db_pass = XOOPS_DB_PASS; 67 $this->db_host = XOOPS_DB_HOST; 68 $this->xoops_db_salt = (defined('XOOPS_DB_SALT')) ? XOOPS_DB_SALT : ''; 69 $this->xoops_salt = (defined('XOOPS_SALT')) ? XOOPS_SALT : ''; 64 $this->module_path=dirname(dirname(__FILE__)); 65 $this->module_name=basename($this->module_path); 66 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 67 $this->xoops_db_prefix = XOOPS_DB_PREFIX . '_'; 68 $this->module_db_prefix = $this->_get_module_db_prefix(); 70 69 $this->xoops_lang = @$GLOBALS["xoopsConfig"]['language']; 71 70 $this->module_id =! empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0; 72 71 $this->module_version = empty($xoopsModule) ? $xoopsModule->getVar('version') : ''; 73 $module_codename = $this->_get_module_codename(); 74 // start /admin/index.php page detect 75 $php_script_name = $_SERVER['SCRIPT_NAME']; 76 $php_query_string = $_SERVER['QUERY_STRING']; 77 $admin_page = basename(dirname(dirname(__FILE__))) . '/admin/index.php'; 78 $is_xoops_module_admin = false; 79 if (strstr($php_script_name,$admin_page) !== false) $is_xoops_module_admin = true; 80 if (strstr($php_query_string,$admin_page) !== false) $is_xoops_module_admin = true; 72 $this->module_codename = $this->_get_module_codename(); 73 $this->wp_version = $this->_get_wp_version(); 74 75 $this->xoops_version = (defined('XOOPS_VERSION')) ? XOOPS_VERSION : ''; 76 $this->_branches_cores(); 81 77 82 78 if (function_exists('date_default_timezone_get')){ 83 79 $this->xoops_time_zone = date_default_timezone_get(); 84 80 } 81 85 82 } 86 83 87 84 function _get_module_db_prefix(){ 85 $module_db_prefix = XOOPS_DB_PREFIX . '_' . preg_replace('/wordpress/','wp',$this->module_name); 86 return $module_db_prefix; 87 } 88 function _branches_cores(){ 89 /* XOOPS include/version.php define value */ 90 //define("XOOPS_VERSION","XOOPS 2.0.16a JP"); 91 //define("XOOPS_VERSION", "XOOPS Cube Legacy 2.2"); 92 //define('XOOPS_VERSION', 'ImpressCMS 1.1.2 Final'); 93 //define("XOOPS_VERSION", "XOOPS JPEx 1.6"); 94 //define("XOOPS_VERSION", "XOOPS 2.3.3"); 95 //define("XOOPS_VERSION", "Xoops Legacy"); define("XOOPS_ENGINE", "legacy"); 96 $this->is_impress_cms = false; 97 $this->is_cube_legacy = false; 98 $this->is_xoops2jp = false; 99 $this->is_xoops2 = false; 100 $this->is_xoops_legacy = false; 101 $this->is_jpex = false; 102 103 $version = XOOPS_VERSION; 104 105 106 // branches by cores 107 if( preg_match('/JP$/', $this->xoops_version)) 108 $this->is_xoops2jp = true; 109 if( preg_match('/Cube\s*Legacy/', $this->xoops_version)) 110 $this->is_cube_legacy = true; 111 if( preg_match('/ImpressCMS/', $this->xoops_version)) 112 $this->is_impress_cms = true; 113 if( preg_match('/JPEx/', $this->xoops_version)) 114 $this->is_jpex = true; 115 if( preg_match('/XOOPS\s*[0-9|\.]*$/', $this->xoops_version)) 116 $this->is_xoops2 = true; 117 if( preg_match('/Xoops\s*Legacy/', $this->xoops_version)) 118 $this->is_xoops_legacy = true; 119 } 120 function _get_wp_version(){ 121 $wp_version_file = dirname(dirname(__FILE__)) . '/wp-includes/version.php'; 122 if (file_exists($wp_version_file)){ 123 include $wp_version_file; 124 return str_replace("ME", "", $wp_version); 125 } 126 return ''; 127 } 128 88 129 // get XPressME module virsion and codename from xoops_versions.php 89 130 function _get_module_codename(){ … … 100 141 return ''; 101 142 } 102 143 function get_xoops_db_prefix(){ 144 return $this->xoops_db_prefix; 145 } 146 147 function get_xoops_root_path(){ 148 return $this->xoops_root_path; 149 } 150 function get_xoops_trust_path(){ 151 return $this->xoops_trust_path; 152 } 153 function get_xoops_mainfile_path(){ 154 return $this->xoops_mainfile_path; 155 } 156 function get_xoops_header_path(){ 157 return $this->xoops_root_path ."/header.php"; 158 } 159 function get_xoops_footer_path(){ 160 return $this->xoops_root_path . '/footer.php'; 161 } 162 function get_xoops_cache_path(){ 163 return $this->xoops_cache_path; 164 } 165 function get_xoops_url(){ 166 return $this->xoops_url; 167 } 168 function get_xoops_upload_path(){ 169 return $this->xoops_upload_path; 170 } 171 function get_xoops_upload_url(){ 172 return $this->xoops_upload_url; 173 } 174 function get_module_path(){ 175 return $this->module_path; 176 } 177 function get_module_templates_path(){ 178 return $this->module_path . '/templates'; 179 } 180 181 function get_module_name(){ 182 return $this->module_name; 183 } 184 function get_module_dirname(){ 185 return $this->module_name; 186 } 187 function get_module_url(){ 188 return $this->module_url; 189 } 190 function get_module_db_prefix(){ 191 return $this->xpress_db_prefix; 192 } 193 function get_xoops_time_zone(){ 194 return $this->xoops_time_zone; 195 } 196 function get_module_version(){ 197 return $this->module_version; 198 } 199 function get_module_codename(){ 200 return $this->module_codename; 201 } 202 function get_wp_version(){ 203 return $this->wp_version; 204 } 205 function get_module_full_version(){ 206 return $this->module_version . $this->module_codename; 207 } 208 209 function is_impress_cms(){ 210 return $this->is_impress_cms; 211 } 212 function is_cube_legacy(){ 213 return $this->is_cube_legacy; 214 } 215 function is_xoops2jp(){ 216 return $this->is_xoops2jp; 217 } 218 function is_xoops2(){ 219 return $this->is_xoops2; 220 } 221 function is_xoops_legacy(){ 222 return $this->is_xoops_legacy; 223 } 224 function is_jpex(){ 225 return $this->is_jpex; 226 } 227 228 function get_moduleID_ByDirname($dir_name){ 229 $module_handler =& xoops_gethandler('module'); 230 $module =& $module_handler->getByDirname($dir_name); 231 $module_id = $module->getVar('mid'); 232 } 233 234 function get_moduleID(){ 235 global $xoopsModule; 236 $module_id = $xoopsModule->getVar('mid'); 237 return $module_id; 238 } 239 240 function get_ModuleConfig($key_name=''){ 241 if (empty($key_name)) return ''; 242 global $xoopsModuleConfig; 243 $value = isset($xoopsModuleConfig[$key_name]) ? $xoopsModuleConfig[$key_name] : ''; 244 } 245 246 function get_ModuleConfig_ByDirname($dir_name,$key_name=''){ 247 $mid = $this->get_moduleID_ByDirname($dir_name); 248 $conf_handler =& xoops_gethandler('config'); 249 $modConfig = $conf_handler->getConfigsByCat(0, $mid); 250 if(empty($modConfig)) return ''; 251 if(empty($key_name)) return $modConfig; 252 return isset($modConfig[$key_name]) ? $modConfig[$key_name] : ''; 253 } 254 103 255 function is_wpdb_installed(){ 104 256 global $xoopsDB; … … 111 263 return false; 112 264 } 113 265 function is_wp_file_found() 266 { 267 if (!file_exists($this->module_path . '/wp-settings.php')){ 268 return false; 269 } 270 return true; 271 } 272 114 273 function is_writeable_mode($check_file) { 115 274 if (!is_dir($check_file)) { … … 135 294 return true; 136 295 } 296 function get_php_version() 297 { 298 if (function_exists('phpversion')) 299 return phpversion(); 300 else 301 return ''; 302 } 303 function get_mysql_version() 304 { 305 global $xoopsDB; 306 list($SV) = $xoopsDB->fetchRow($xoopsDB->query('SELECT version()')); 307 return $SV; 308 } 309 public function get_mod_image_link($file_name='') 310 { 311 $link_url = ''; 312 if(!empty($file_name)){ 313 if(file_exists($this->module_path.'/images/'.$file_name)){ 314 $link_url = '<img alt="'.$file_name.'" src="'. $this->mod_url .'/images/'.$file_name.'" title="'.$file_name.'" align=top>'; 315 } 316 } 317 return $link_url; 318 } 319 function get_wpLang($xoops_lang=''){ 320 return $this->wpConfigInfo->get_wpLang($xoops_lang); 321 } 137 322 138 323 } 324 endif; 139 325 ?> -
branches/Ver3.0/xpressme_integration_kit/class/xpressD3commentContent.class.php
r749 r757 44 44 function displayCommentsInline( $params ) 45 45 { 46 global $ xoops_config;46 global $modInfo; 47 47 if ( function_exists('date_default_timezone_set') ) 48 date_default_timezone_set($ xoops_config->xoops_time_zone);48 date_default_timezone_set($modInfo->get_xoops_time_zone()); 49 49 $new_params = $this->restructParams( $params ) ; 50 50 if (!$this->canAddComment($params['id']) ) {
Note: See TracChangeset
for help on using the changeset viewer.