Changeset 669
- Timestamp:
- Nov 25, 2010, 10:53:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/class/config_from_xoops.class.php
r657 r669 45 45 var $module_config= array(); 46 46 var $xoops_time_zone; 47 var $xoops_var_path; 48 var $xoops_db_charset; 49 var $xoops_db_pconnect; 47 50 48 51 function __constructor() //for PHP5 … … 81 84 if(file_exists($this->xoops_mainfile_path)){ 82 85 $this->_get_value_by_xoops_mainfile(); 86 87 // Xoops2.5 secure.php 88 if (!empty($this->xoops_var_path)){ 89 $secure_path = $this->xoops_var_path . "/data/secure.php"; 90 if (file_exists($secure_path)){ 91 $this->_get_value_by_xoops_secure($secure_path); 92 } 93 } 94 83 95 // Value 'is_impress' and value 'external_define_path' used in the under 84 96 // are set in _get_value_by_xoops_mainfile(). … … 150 162 $this->xoops_salt = $this->xpress_eval($key_value); 151 163 break; 164 case 'XOOPS_VAR_PATH': 165 $this->xoops_var_path = $this->xpress_eval($key_value); 166 break; 152 167 default : 153 168 … … 167 182 $this->impress_db_config_file = $this->xoops_trust_path . $impres_matchs[2]; 168 183 } 184 } // end of for loop 185 } 186 // A set value is acquired from XOOPS mainfile.php by the pattern match. 187 function _get_value_by_xoops_secure($secure_path){ 188 $array_file = file($secure_path); 189 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*([^\s]+.*)\s*\)\s*;'; 190 $impress_include_pattern = '^\s*(include_once|include)\s*\(\s*XOOPS_TRUST_PATH\s*.\s*[\'"]([^\'"]+)[\'"]\s*\)'; 191 $external_define_file_pattern = '^\s*(include_once|include|require_once|require_once)\s*\((.*mainfile\.php.*)\)'; 192 for ($i = 0 ; $i <count($array_file) ; $i++){ 193 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ 194 $keys = $matchs[1]; 195 if (preg_match('/^\'[^\']*\'$/',$keys)) $keys = preg_replace('/\'/', '', $keys); 196 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 197 $key_value = $matchs[2]; 198 199 switch ($keys){ 200 case 'XOOPS_DB_PREFIX': 201 $this->xoops_db_prefix = $this->xpress_eval($key_value); 202 break; 203 case 'XOOPS_DB_NAME': 204 $this->xoops_db_name = $this->xpress_eval($key_value); 205 break; 206 case 'XOOPS_DB_USER': 207 $this->xoops_db_user = $this->xpress_eval($key_value); 208 break; 209 case 'XOOPS_DB_PASS': 210 $this->xoops_db_pass = $this->xpress_eval($key_value); 211 break; 212 case 'XOOPS_DB_HOST': 213 $this->xoops_db_host = $this->xpress_eval($key_value); 214 break; 215 case 'XOOPS_DB_SALT': 216 $this->xoops_db_salt = $this->xpress_eval($key_value); 217 break; 218 case 'XOOPS_SALT': 219 $this->xoops_salt = $this->xpress_eval($key_value); 220 break; 221 case 'XOOPS_DB_CHARSET': 222 $this->xoops_db_charset = $this->xpress_eval($key_value); 223 break; 224 case 'XOOPS_DB_PCONNECT': 225 $this->xoops_db_pconnect = $this->xpress_eval($key_value); 226 break; 227 default : 228 229 } // end of switch 230 } // end of if preg_match 231 169 232 } // end of for loop 170 233 }
Note: See TracChangeset
for help on using the changeset viewer.