Changeset 159 for trunk/class/config_from_xoops.class.php
- Timestamp:
- Apr 6, 2009, 6:49:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/class/config_from_xoops.class.php
r133 r159 32 32 var $xoops_upload_url; 33 33 var $xoops_db_salt; 34 var $xoops_salt; 34 35 var $is_impress; 35 36 var $impress_db_config_file; … … 41 42 42 43 } 44 45 function xpress_eval($str){ 46 $eval_str = '$ret = ' . $str . ' ;'; 47 eval($eval_str); 48 return $ret; 49 } 43 50 44 51 function ConfigFromXoops() //for PHP4 constructor … … 49 56 if(file_exists($this->xoops_mainfile_path)){ 50 57 $array_file = file($this->xoops_mainfile_path); 51 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*(\' [^\']*\'|"[^"]*"|[^\'"])\s*\)\s*;';58 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*(\'.*\'|".*"|[^\'"]*)\s*\)\s*;'; 52 59 $impress_include_pattern = '^\s*(include_once|include)\s*\(\s*XOOPS_TRUST_PATH\s*.\s*[\'"]([^\'"]+)[\'"]\s*\)'; 53 60 for ($i = 0 ; $i <count($array_file) ; $i++){ … … 57 64 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 58 65 $key_value = $matchs[2]; 59 if (preg_match('/^\'[^\']*\'$/',$key_value)) $key_value = preg_replace('/\'/', '', $key_value); 60 if (preg_match('/^"[^"]*"$/',$key_value)) $key_value = preg_replace('/"/', '', $key_value); 66 61 67 switch ($keys){ 62 68 case 'XOOPS_ROOT_PATH': 63 $this->xoops_root_path = $ key_value;69 $this->xoops_root_path = $this->xpress_eval($key_value); 64 70 $this->xoops_url . '/modules/' . $this->module_name; 65 71 break; 66 72 case 'XOOPS_URL': 67 $this->xoops_url = $ key_value;73 $this->xoops_url = $this->xpress_eval($key_value); 68 74 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 69 75 break; 70 76 case 'XOOPS_TRUST_PATH': 71 $this->xoops_trust_path = $ key_value;77 $this->xoops_trust_path = $this->xpress_eval($key_value); 72 78 break; 73 79 case 'XOOPS_DB_PREFIX': 74 $this->xoops_db_prefix = $ key_value;80 $this->xoops_db_prefix = $this->xpress_eval($key_value); 75 81 break; 76 82 case 'XOOPS_DB_NAME': 77 $this->xoops_db_name = $ key_value;83 $this->xoops_db_name = $this->xpress_eval($key_value); 78 84 break; 79 85 case 'XOOPS_DB_USER': 80 $this->xoops_db_user = $ key_value;86 $this->xoops_db_user = $this->xpress_eval($key_value); 81 87 break; 82 88 case 'XOOPS_DB_PASS': 83 $this->xoops_db_pass = $ key_value;89 $this->xoops_db_pass = $this->xpress_eval($key_value); 84 90 break; 85 91 case 'XOOPS_DB_HOST': 86 $this->xoops_db_host = $ key_value;92 $this->xoops_db_host = $this->xpress_eval($key_value); 87 93 break; 88 94 case 'XOOPS_DB_SALT': 89 $this->xoops_db_salt = $key_value; 95 $this->xoops_db_salt = $this->xpress_eval($key_value); 96 break; 97 case 'XOOPS_SALT': 98 $this->xoops_salt = $this->xpress_eval($key_value); 90 99 break; 91 100 default : … … 113 122 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 114 123 $key_value = $matchs[2]; 115 if (preg_match('/^\'[^\']*\'$/',$key_value)) $key_value = preg_replace('/\'/', '', $key_value); 116 if (preg_match('/^"[^"]*"$/',$key_value)) $key_value = preg_replace('/"/', '', $key_value); 124 117 125 switch ($keys){ 118 126 case 'SDATA_DB_SALT': 119 $this->xoops_db_salt = $ key_value;127 $this->xoops_db_salt = $this->xpress_eval($key_value); 120 128 break; 121 129 case 'SDATA_DB_PREFIX': 122 $this->xoops_db_prefix = $ key_value;130 $this->xoops_db_prefix = $this->xpress_eval($key_value); 123 131 break; 124 132 case 'SDATA_DB_NAME': 125 $this->xoops_db_name = $ key_value;133 $this->xoops_db_name = $this->xpress_eval($key_value); 126 134 break; 127 135 case 'SDATA_DB_USER': 128 $this->xoops_db_user = $ key_value;136 $this->xoops_db_user = $this->xpress_eval($key_value); 129 137 break; 130 138 case 'SDATA_DB_PASS': 131 $this->xoops_db_pass = $ key_value;139 $this->xoops_db_pass = $this->xpress_eval($key_value); 132 140 break; 133 141 case 'SDATA_DB_HOST': 134 $this->xoops_db_host = $ key_value;142 $this->xoops_db_host = $this->xpress_eval($key_value); 135 143 break; 136 144 default :
Note: See TracChangeset
for help on using the changeset viewer.