- Timestamp:
- Jun 1, 2011, 7:42:28 PM (14 years ago)
- Location:
- trunk/xpressme_integration_kit
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/class/modInfo_class.php
r783 r786 12 12 13 13 class modInfoClass { 14 var $db_name; 15 var $db_user; 16 var $db_pass; 17 var $db_host; 18 var $db_salt; 19 var $xoops_db_prefix; 20 var $module_db_prefix; 21 14 22 var $xoops_mainfile_path; 15 23 var $xoops_root_path; … … 22 30 var $xoops_db_salt; 23 31 var $xoops_salt; 24 var $xoops_db_prefix;25 32 var $xoops_language; 26 var $module_db_prefix;27 33 var $module_name; 28 34 var $module_path; … … 41 47 var $wp_version; 42 48 var $wpConfigInfo; 43 49 var $factory; 50 var $module; 51 var $langInfo; 44 52 function __constructor() //for PHP5 45 53 { … … 50 58 function modInfoClass() //for PHP4 constructor 51 59 { 52 global $xoopsModule,$wpConfigInfo,$xoopsConfig; 53 if (!is_object($wpConfigInfo)){ 54 include_once dirname(__FILE__).'/wpConfigInfo_class.php'; 55 $this->wpConfigInfo = new wpConfigInfoClass; 56 } 60 global $xoopsModule; 61 62 57 63 if (! is_object($xoopsModule)){ 58 $module_handler =& xoops_gethandler('module'); 59 $xoopsModule =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__)))); 60 } 61 62 $this->xoops_root_path = XOOPS_ROOT_PATH; 64 // $module_handler =& xoops_gethandler('module'); 65 // $xoopsModule =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__)))); 66 } 67 $this->_branches_cores(); 68 if ($this->is_xoops_legacy) $this->factory = XOOPS::factory(); 69 if (is_object($this->factory)){ 70 // $module_handler = & XOOPS::getHandle('module'); 71 } else { 72 // $module_handler =& xoops_gethandler('module'); 73 } 74 // $this->module =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__)))); 75 $this->_get_db_ini(); 76 $this->module_db_prefix = $this->_get_module_db_prefix(); 77 $this->xoops_root_path = $this->_get_xoops_root_path(); 63 78 $this->xoops_trust_path = (defined('XOOPS_TRUST_PATH')) ? XOOPS_TRUST_PATH : ''; 64 $this->xoops_url = XOOPS_URL; 65 $this->xoops_mainfile_path = XOOPS_ROOT_PATH . '/mainfile.php'; 66 $this->xoops_upload_path = XOOPS_UPLOAD_PATH; 67 $this->xoops_upload_url = XOOPS_UPLOAD_URL; 68 $this->xoops_cache_path = XOOPS_CACHE_PATH; 79 $this->xoops_var_path = $this->_get_xoops_var_path(); 80 $this->xoops_url = $this->_get_xoops_url(); 81 $this->xoops_mainfile_path = $this->xoops_root_path . '/mainfile.php'; 82 $this->xoops_upload_path = $this->_get_xoops_upload_path(); 83 $this->xoops_upload_url = $this->_get_xoops_upload_url(); 84 $this->xoops_cache_path = $this->_get_xoops_cache_path(); 69 85 $this->module_path=dirname(dirname(__FILE__)); 70 86 $this->module_name=basename($this->module_path); 71 87 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 72 $this->xoops_db_prefix = XOOPS_DB_PREFIX . '_';73 $this->module_db_prefix = $this->_get_module_db_prefix();74 88 $this->xoops_lang = @$GLOBALS["xoopsConfig"]['language']; 75 89 $this->module_id = ! empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0; … … 86 100 $this->xoops_time_zone = $xoopsConfig['default_TZ']; 87 101 } 102 require_once dirname( __FILE__ ).'/langInfo_class.php' ; 103 $this->langInfo = new langInfoClass; 88 104 } 89 105 function _get_xoops_root_path(){ 106 if (defined('XOOPS_ROOT_PATH')) return XOOPS_ROOT_PATH; 107 return $this->factory->path('www'); //XOOPS Engine 108 } 109 function _get_xoops_var_path(){ 110 if (defined('XOOPS_VAR_PATH')) return XOOPS_VAR_PATH; 111 return $this->factory->path('var'); //XOOPS Engine 112 } 113 function _get_xoops_cache_path(){ 114 if (defined('XOOPS_CACHE_PATH')) return XOOPS_CACHE_PATH; 115 return $this->factory->path('var'). "/cache/system"; //XOOPS Engine 116 } 117 function _get_xoops_url(){ 118 if (defined('XOOPS_URL')) return XOOPS_URL; 119 return $this->factory->url('',true); //XOOPS Engine 120 } 121 function _get_xoops_upload_path(){ 122 if (defined('XOOPS_UPLOAD_PATH')) return XOOPS_UPLOAD_PATH; 123 return $this->factory->path('upload'); //XOOPS Engine 124 } 125 function _get_xoops_upload_url(){ 126 if (defined('XOOPS_UPLOAD_URL')) return XOOPS_UPLOAD_URL; 127 return $this->factory->url('upload',true); //XOOPS Engine 128 } 129 130 function _get_db_ini(){ 131 if (defined('XOOPS_DB_NAME')){ 132 $this->xoops_db_prefix = XOOPS_DB_PREFIX . '_'; 133 $this->db_name = XOOPS_DB_NAME; 134 $this->db_user = XOOPS_DB_USER; 135 $this->db_pass = XOOPS_DB_PASS; 136 $this->db_host = XOOPS_DB_HOST; 137 return; 138 } 139 140 if(!defined('XOOPS_VAR_PATH') ) { 141 $var_path = $this->factory->path('var'); //XOOPS Engine 142 } else { 143 $var_path = XOOPS_VAR_PATH; 144 } 145 $def_file = $var_path . '/etc/resource.db.ini.php'; 146 if(! file_exists($def_file)) return; 147 $array_file = file($def_file); 148 foreach ($array_file as $line){ 149 if (preg_match('/^\s*dbname\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 150 $this->db_name = $matchs[1]; 151 if (preg_match('/^\s*host\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 152 $this->db_host = $matchs[1]; 153 if (preg_match('/^\s*username\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 154 $this->db_user = $matchs[1]; 155 if (preg_match('/^\s*password\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 156 $this->db_pass = $matchs[1]; 157 if (preg_match('/^\s*prefix\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 158 $this->xoops_db_prefix = $matchs[1].'_'; 159 } 160 } 90 161 function _get_module_db_prefix(){ 91 $module_db_prefix = XOOPS_DB_PREFIX . '_' . preg_replace('/wordpress/','wp',$this->module_name); 162 $module_name = basename(dirname(dirname(__FILE__))); 163 $module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_name) . '_'; 92 164 return $module_db_prefix; 93 165 } 166 94 167 function _branches_cores(){ 95 168 /* XOOPS include/version.php define value */ … … 106 179 $this->is_xoops_legacy = false; 107 180 $this->is_jpex = false; 108 181 if (!defined('XOOPS_VERSION')){ 182 $root_path = dirname(dirname(dirname(dirname(__FILE__)))); 183 include_once $root_path . '/include/version.php'; 184 } 109 185 $version = XOOPS_VERSION; 110 186 111 187 112 188 // branches by cores 113 if( preg_match('/JP$/', $ this->xoops_version))189 if( preg_match('/JP$/', $version)) 114 190 $this->is_xoops2jp = true; 115 if( preg_match('/Cube\s*Legacy/', $ this->xoops_version))191 if( preg_match('/Cube\s*Legacy/', $version)) 116 192 $this->is_cube_legacy = true; 117 if( preg_match('/ImpressCMS/', $ this->xoops_version))193 if( preg_match('/ImpressCMS/', $version)) 118 194 $this->is_impress_cms = true; 119 if( preg_match('/JPEx/', $ this->xoops_version))195 if( preg_match('/JPEx/', $version)) 120 196 $this->is_jpex = true; 121 if( preg_match('/XOOPS\s*[0-9|\.]*$/', $ this->xoops_version))197 if( preg_match('/XOOPS\s*[0-9|\.]*$/', $version)) 122 198 $this->is_xoops2 = true; 123 if( preg_match('/Xoops\s*Legacy/', $ this->xoops_version))199 if( preg_match('/Xoops\s*Legacy/', $version)) 124 200 $this->is_xoops_legacy = true; 125 201 } … … 150 226 return $this->xoops_db_prefix; 151 227 } 228 function get_module_db_prefix($module_dirnam=''){ 229 if (empty($module_dirname)){ 230 return $this->module_db_prefix; 231 } else { 232 $module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_dirname) . '_'; 233 return $module_db_prefix; 234 } 235 } 236 function get_db_name(){ 237 return $this->db_name; 238 } 239 function get_db_user(){ 240 return $this->db_user; 241 } 242 function get_db_pass(){ 243 return $this->db_pass; 244 } 245 function get_db_host(){ 246 return $this->db_host; 247 } 248 function get_db_salt(){ 249 return $this->db_salt; 250 } 251 function get_wpLang($xoops_lang=''){ 252 return $this->langInfo->get_wpLang($xoops_lang); 253 } 152 254 153 255 function get_xoops_root_path(){ … … 194 296 return $this->module_url; 195 297 } 196 function get_module_db_prefix(){197 return $this->xpress_db_prefix;198 }199 298 function get_xoops_time_zone(){ 200 299 return $this->xoops_time_zone; … … 233 332 234 333 function get_moduleID_ByDirname($dir_name){ 334 if (! function_exists('xoops_gethandler')) return ''; 235 335 $module_handler =& xoops_gethandler('module'); 236 336 $module =& $module_handler->getByDirname($dir_name); … … 314 414 return $SV; 315 415 } 316 publicfunction get_mod_image_link($file_name='')416 function get_mod_image_link($file_name='') 317 417 { 318 418 $link_url = ''; … … 324 424 return $link_url; 325 425 } 326 function get_wpLang($xoops_lang=''){327 return $this->wpConfigInfo->get_wpLang($xoops_lang);328 }329 426 330 427 } -
trunk/xpressme_integration_kit/include/add_xpress_config.php
r782 r786 9 9 if ( defined('WP_ADMIN') ) { 10 10 $nocommon_scripts = array( 11 'wp-admin', 11 12 'wp-admin/async-upload.php', 12 13 ); 13 14 foreach($nocommon_scripts as $nocommon_script){ 14 15 if (strstr($_SERVER['SCRIPT_NAME'],$nocommon_script) !== false) { 15 $xoopsOption['nocommon'] = 1; 16 defined('XOOPS_BOOTSTRAP') or define('XOOPS_BOOTSTRAP', false); // For XE 17 $xoopsOption['nocommon'] = 1; // For Other 16 18 break; 17 19 } … … 24 26 25 27 require_once dirname( __FILE__ ).'/xpress_debug_log.php' ; 26 require_once dirname(dirname( __FILE__ )).'/class/wpConfigInfo_class.php' ;27 $wpConfigInfo = new wpConfigInfoClass;28 28 require_once dirname(dirname( __FILE__ )).'/class/modInfo_class.php' ; 29 29 $modInfo = new modInfoClass; 30 require_once dirname(dirname( __FILE__ )).'/class/userInfo_class.php' ; 31 $userInfo = new userInfoClass; 30 //require_once dirname(dirname( __FILE__ )).'/class/userInfo_class.php' ; 31 //$userInfo = new userInfoClass; 32 32 33 require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ; 34 35 33 36 ?>
Note: See TracChangeset
for help on using the changeset viewer.