Changeset 326
- Timestamp:
- Jul 8, 2009, 3:46:33 PM (15 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Ver2.0/xpressme_integration_kit/class/config_from_xoops.class.php
r232 r326 15 15 var $xoops_mainfile_path; 16 16 var $define_arry = array(); 17 var $external_define_path; 17 18 var $xoops_root_path; 18 19 var $xoops_url; … … 57 58 $this->module_path=dirname(dirname(__FILE__)); 58 59 $this->module_name=basename($this->module_path); 59 if(file_exists($this->xoops_mainfile_path)){ 60 $array_file = file($this->xoops_mainfile_path); 61 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*([^\s]+.*)\s*\)\s*;'; 62 $impress_include_pattern = '^\s*(include_once|include)\s*\(\s*XOOPS_TRUST_PATH\s*.\s*[\'"]([^\'"]+)[\'"]\s*\)'; 63 for ($i = 0 ; $i <count($array_file) ; $i++){ 64 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ 65 $keys = $matchs[1]; 66 if (preg_match('/^\'[^\']*\'$/',$keys)) $keys = preg_replace('/\'/', '', $keys); 67 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 68 $key_value = $matchs[2]; 69 70 switch ($keys){ 71 case 'XOOPS_ROOT_PATH': 72 $this->xoops_root_path = $this->xpress_eval($key_value); 73 $this->xoops_url . '/modules/' . $this->module_name; 74 break; 75 case 'XOOPS_URL': 76 $this->xoops_url = $this->xpress_eval($key_value); 77 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 78 break; 79 case 'XOOPS_TRUST_PATH': 80 $this->xoops_trust_path = $this->xpress_eval($key_value); 81 break; 82 case 'XOOPS_DB_PREFIX': 83 $this->xoops_db_prefix = $this->xpress_eval($key_value); 84 break; 85 case 'XOOPS_DB_NAME': 86 $this->xoops_db_name = $this->xpress_eval($key_value); 87 break; 88 case 'XOOPS_DB_USER': 89 $this->xoops_db_user = $this->xpress_eval($key_value); 90 break; 91 case 'XOOPS_DB_PASS': 92 $this->xoops_db_pass = $this->xpress_eval($key_value); 93 break; 94 case 'XOOPS_DB_HOST': 95 $this->xoops_db_host = $this->xpress_eval($key_value); 96 break; 97 case 'XOOPS_DB_SALT': 98 $this->xoops_db_salt = $this->xpress_eval($key_value); 99 break; 100 case 'XOOPS_SALT': 101 $this->xoops_salt = $this->xpress_eval($key_value); 102 break; 103 default : 104 105 } // end of switch 106 } // end of if preg_match 107 108 // Check ImpressCMS 109 if (preg_match('/' . $impress_include_pattern . '/' ,$array_file[$i],$impres_matchs)){ 110 $this->is_impress = true; 111 $this->impress_db_config_file = $this->xoops_trust_path . $impres_matchs[2]; 112 } 113 } // end of for loop 114 } // end of if file_exists 115 116 // DB Config from Impress CMS impress_db_config file 117 if ($this->is_impress){ 118 if(file_exists($this->impress_db_config_file)){ 119 $array_file = file($this->impress_db_config_file); 120 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*(\'[^\']*\'|"[^"]*"|[^\'"])\s*\)\s*;'; 60 if (defined('XOOPS_MAINFILE_INCLUDED')){ 61 $this->xoops_root_path = XOOPS_ROOT_PATH; 62 $this->xoops_url = XOOPS_URL; 63 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 64 if(defined('XOOPS_TRUST_PATH')) $this->xoops_trust_path = XOOPS_TRUST_PATH; else $this->xoops_trust_path = ''; 65 $this->xoops_db_prefix = XOOPS_DB_PREFIX; 66 $this->xoops_db_name = XOOPS_DB_NAME; 67 $this->xoops_db_user = XOOPS_DB_USER; 68 $this->xoops_db_pass = XOOPS_DB_PASS; 69 $this->xoops_db_host = XOOPS_DB_HOST; 70 if(defined('XOOPS_DB_SALT')) $this->xoops_db_salt = XOOPS_DB_SALT; else $this->xoops_db_salt = ''; 71 if(defined('XOOPS_SALT')) $this->xoops_salt = XOOPS_SALT; else $this->xoops_salt = ''; 72 } else { 73 if(file_exists($this->xoops_mainfile_path)){ 74 $array_file = file($this->xoops_mainfile_path); 75 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*([^\s]+.*)\s*\)\s*;'; 76 $impress_include_pattern = '^\s*(include_once|include)\s*\(\s*XOOPS_TRUST_PATH\s*.\s*[\'"]([^\'"]+)[\'"]\s*\)'; 77 $external_define_file_pattern = '^\s*(include_once|include|require_once|require_once)\s*\((.*mainfile\.php.*)\)'; 121 78 for ($i = 0 ; $i <count($array_file) ; $i++){ 122 79 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ … … 127 84 128 85 switch ($keys){ 129 case 'SDATA_DB_SALT': 86 case 'XOOPS_ROOT_PATH': 87 $this->xoops_root_path = $this->xpress_eval($key_value); 88 break; 89 case 'XOOPS_URL': 90 $this->xoops_url = $this->xpress_eval($key_value); 91 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 92 break; 93 case 'XOOPS_TRUST_PATH': 94 $this->xoops_trust_path = $this->xpress_eval($key_value); 95 break; 96 case 'XOOPS_DB_PREFIX': 97 $this->xoops_db_prefix = $this->xpress_eval($key_value); 98 break; 99 case 'XOOPS_DB_NAME': 100 $this->xoops_db_name = $this->xpress_eval($key_value); 101 break; 102 case 'XOOPS_DB_USER': 103 $this->xoops_db_user = $this->xpress_eval($key_value); 104 break; 105 case 'XOOPS_DB_PASS': 106 $this->xoops_db_pass = $this->xpress_eval($key_value); 107 break; 108 case 'XOOPS_DB_HOST': 109 $this->xoops_db_host = $this->xpress_eval($key_value); 110 break; 111 case 'XOOPS_DB_SALT': 130 112 $this->xoops_db_salt = $this->xpress_eval($key_value); 131 113 break; 132 case 'SDATA_DB_PREFIX': 133 $this->xoops_db_prefix = $this->xpress_eval($key_value); 134 break; 135 case 'SDATA_DB_NAME': 136 $this->xoops_db_name = $this->xpress_eval($key_value); 137 break; 138 case 'SDATA_DB_USER': 139 $this->xoops_db_user = $this->xpress_eval($key_value); 140 break; 141 case 'SDATA_DB_PASS': 142 $this->xoops_db_pass = $this->xpress_eval($key_value); 143 break; 144 case 'SDATA_DB_HOST': 145 $this->xoops_db_host = $this->xpress_eval($key_value); 114 case 'XOOPS_SALT': 115 $this->xoops_salt = $this->xpress_eval($key_value); 146 116 break; 147 117 default : 148 118 149 119 } // end of switch 120 } // end of if preg_match 121 122 // Check External Define File 123 if (preg_match('/' . $external_define_file_pattern . '/' ,$array_file[$i],$trust_main_matchs)){ 124 $include_path = $this->xpress_eval($trust_main_matchs[2]); 125 if (file_exists($include_path)) 126 $this->external_define_path = $include_path; 150 127 } 151 } // end of for 128 129 // Check ImpressCMS 130 if (preg_match('/' . $impress_include_pattern . '/' ,$array_file[$i],$impres_matchs)){ 131 $this->is_impress = true; 132 $this->impress_db_config_file = $this->xoops_trust_path . $impres_matchs[2]; 133 } 134 } // end of for loop 135 } // end of if file_exists 136 137 // DB Config from Impress CMS impress_db_config file 138 if ($this->is_impress){ 139 if(file_exists($this->impress_db_config_file)){ 140 $array_file = file($this->impress_db_config_file); 141 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*(\'[^\']*\'|"[^"]*"|[^\'"])\s*\)\s*;'; 142 for ($i = 0 ; $i <count($array_file) ; $i++){ 143 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ 144 $keys = $matchs[1]; 145 if (preg_match('/^\'[^\']*\'$/',$keys)) $keys = preg_replace('/\'/', '', $keys); 146 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 147 $key_value = $matchs[2]; 148 149 switch ($keys){ 150 case 'SDATA_DB_SALT': 151 $this->xoops_db_salt = $this->xpress_eval($key_value); 152 break; 153 case 'SDATA_DB_PREFIX': 154 $this->xoops_db_prefix = $this->xpress_eval($key_value); 155 break; 156 case 'SDATA_DB_NAME': 157 $this->xoops_db_name = $this->xpress_eval($key_value); 158 break; 159 case 'SDATA_DB_USER': 160 $this->xoops_db_user = $this->xpress_eval($key_value); 161 break; 162 case 'SDATA_DB_PASS': 163 $this->xoops_db_pass = $this->xpress_eval($key_value); 164 break; 165 case 'SDATA_DB_HOST': 166 $this->xoops_db_host = $this->xpress_eval($key_value); 167 break; 168 default : 169 170 } // end of switch 171 } 172 } // end of for 173 } // end of if file_exists 174 } // end ofImpress CMS 175 176 // DB Config from external define file 177 if(!empty($this->external_define_path)){ 178 if(file_exists($this->external_define_path)){ 179 require_once($this->external_define_path); 180 181 $this->xoops_root_path = XOOPS_ROOT_PATH; 182 $this->xoops_url = XOOPS_URL; 183 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 184 if(defined('XOOPS_TRUST_PATH')) $this->xoops_trust_path = XOOPS_TRUST_PATH; else $this->xoops_trust_path = ''; 185 $this->xoops_db_prefix = XOOPS_DB_PREFIX; 186 $this->xoops_db_name = XOOPS_DB_NAME; 187 $this->xoops_db_user = XOOPS_DB_USER; 188 $this->xoops_db_pass = XOOPS_DB_PASS; 189 $this->xoops_db_host = XOOPS_DB_HOST; 190 if(defined('XOOPS_DB_SALT')) $this->xoops_db_salt = XOOPS_DB_SALT; else $this->xoops_db_salt = ''; 191 if(defined('XOOPS_SALT')) $this->xoops_salt = XOOPS_SALT; else $this->xoops_salt = ''; 192 } // end of if file_exists 152 193 } 153 194 } -
trunk/xpressme_integration_kit/class/config_from_xoops.class.php
r252 r326 15 15 var $xoops_mainfile_path; 16 16 var $define_arry = array(); 17 var $external_define_path; 17 18 var $xoops_root_path; 18 19 var $xoops_url; … … 56 57 { 57 58 $this->xoops_mainfile_path = $this->get_xoops_mainfile_path(); 58 $this->module_path=dirname(dirname(__FILE__)); 59 $this->module_path=dirname(dirname(__FILE__)); 59 60 $this->module_name=basename($this->module_path); 60 if(file_exists($this->xoops_mainfile_path)){ 61 $array_file = file($this->xoops_mainfile_path); 62 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*([^\s]+.*)\s*\)\s*;'; 63 $impress_include_pattern = '^\s*(include_once|include)\s*\(\s*XOOPS_TRUST_PATH\s*.\s*[\'"]([^\'"]+)[\'"]\s*\)'; 64 for ($i = 0 ; $i <count($array_file) ; $i++){ 65 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ 66 $keys = $matchs[1]; 67 if (preg_match('/^\'[^\']*\'$/',$keys)) $keys = preg_replace('/\'/', '', $keys); 68 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 69 $key_value = $matchs[2]; 70 71 switch ($keys){ 72 case 'XOOPS_ROOT_PATH': 73 $this->xoops_root_path = $this->xpress_eval($key_value); 74 $this->xoops_url . '/modules/' . $this->module_name; 75 break; 76 case 'XOOPS_URL': 77 $this->xoops_url = $this->xpress_eval($key_value); 78 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 79 break; 80 case 'XOOPS_TRUST_PATH': 81 $this->xoops_trust_path = $this->xpress_eval($key_value); 82 break; 83 case 'XOOPS_DB_PREFIX': 84 $this->xoops_db_prefix = $this->xpress_eval($key_value); 85 break; 86 case 'XOOPS_DB_NAME': 87 $this->xoops_db_name = $this->xpress_eval($key_value); 88 break; 89 case 'XOOPS_DB_USER': 90 $this->xoops_db_user = $this->xpress_eval($key_value); 91 break; 92 case 'XOOPS_DB_PASS': 93 $this->xoops_db_pass = $this->xpress_eval($key_value); 94 break; 95 case 'XOOPS_DB_HOST': 96 $this->xoops_db_host = $this->xpress_eval($key_value); 97 break; 98 case 'XOOPS_DB_SALT': 99 $this->xoops_db_salt = $this->xpress_eval($key_value); 100 break; 101 case 'XOOPS_SALT': 102 $this->xoops_salt = $this->xpress_eval($key_value); 103 break; 104 default : 105 106 } // end of switch 107 } // end of if preg_match 108 109 // Check ImpressCMS 110 if (preg_match('/' . $impress_include_pattern . '/' ,$array_file[$i],$impres_matchs)){ 111 $this->is_impress = true; 112 $this->impress_db_config_file = $this->xoops_trust_path . $impres_matchs[2]; 113 } 114 } // end of for loop 115 } // end of if file_exists 116 117 // DB Config from Impress CMS impress_db_config file 118 if ($this->is_impress){ 119 if(file_exists($this->impress_db_config_file)){ 120 $array_file = file($this->impress_db_config_file); 121 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*(\'[^\']*\'|"[^"]*"|[^\'"])\s*\)\s*;'; 61 if (defined('XOOPS_MAINFILE_INCLUDED')){ 62 $this->xoops_root_path = XOOPS_ROOT_PATH; 63 $this->xoops_url = XOOPS_URL; 64 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 65 if(defined('XOOPS_TRUST_PATH')) $this->xoops_trust_path = XOOPS_TRUST_PATH; else $this->xoops_trust_path = ''; 66 $this->xoops_db_prefix = XOOPS_DB_PREFIX; 67 $this->xoops_db_name = XOOPS_DB_NAME; 68 $this->xoops_db_user = XOOPS_DB_USER; 69 $this->xoops_db_pass = XOOPS_DB_PASS; 70 $this->xoops_db_host = XOOPS_DB_HOST; 71 if(defined('XOOPS_DB_SALT')) $this->xoops_db_salt = XOOPS_DB_SALT; else $this->xoops_db_salt = ''; 72 if(defined('XOOPS_SALT')) $this->xoops_salt = XOOPS_SALT; else $this->xoops_salt = ''; 73 } else { 74 if(file_exists($this->xoops_mainfile_path)){ 75 $array_file = file($this->xoops_mainfile_path); 76 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*([^\s]+.*)\s*\)\s*;'; 77 $impress_include_pattern = '^\s*(include_once|include)\s*\(\s*XOOPS_TRUST_PATH\s*.\s*[\'"]([^\'"]+)[\'"]\s*\)'; 78 $external_define_file_pattern = '^\s*(include_once|include|require_once|require_once)\s*\((.*mainfile\.php.*)\)'; 122 79 for ($i = 0 ; $i <count($array_file) ; $i++){ 123 80 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ … … 128 85 129 86 switch ($keys){ 130 case 'SDATA_DB_SALT': 87 case 'XOOPS_ROOT_PATH': 88 $this->xoops_root_path = $this->xpress_eval($key_value); 89 break; 90 case 'XOOPS_URL': 91 $this->xoops_url = $this->xpress_eval($key_value); 92 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 93 break; 94 case 'XOOPS_TRUST_PATH': 95 $this->xoops_trust_path = $this->xpress_eval($key_value); 96 break; 97 case 'XOOPS_DB_PREFIX': 98 $this->xoops_db_prefix = $this->xpress_eval($key_value); 99 break; 100 case 'XOOPS_DB_NAME': 101 $this->xoops_db_name = $this->xpress_eval($key_value); 102 break; 103 case 'XOOPS_DB_USER': 104 $this->xoops_db_user = $this->xpress_eval($key_value); 105 break; 106 case 'XOOPS_DB_PASS': 107 $this->xoops_db_pass = $this->xpress_eval($key_value); 108 break; 109 case 'XOOPS_DB_HOST': 110 $this->xoops_db_host = $this->xpress_eval($key_value); 111 break; 112 case 'XOOPS_DB_SALT': 131 113 $this->xoops_db_salt = $this->xpress_eval($key_value); 132 114 break; 133 case 'SDATA_DB_PREFIX': 134 $this->xoops_db_prefix = $this->xpress_eval($key_value); 135 break; 136 case 'SDATA_DB_NAME': 137 $this->xoops_db_name = $this->xpress_eval($key_value); 138 break; 139 case 'SDATA_DB_USER': 140 $this->xoops_db_user = $this->xpress_eval($key_value); 141 break; 142 case 'SDATA_DB_PASS': 143 $this->xoops_db_pass = $this->xpress_eval($key_value); 144 break; 145 case 'SDATA_DB_HOST': 146 $this->xoops_db_host = $this->xpress_eval($key_value); 115 case 'XOOPS_SALT': 116 $this->xoops_salt = $this->xpress_eval($key_value); 147 117 break; 148 118 default : 149 119 150 120 } // end of switch 121 } // end of if preg_match 122 123 // Check External Define File 124 if (preg_match('/' . $external_define_file_pattern . '/' ,$array_file[$i],$trust_main_matchs)){ 125 $include_path = $this->xpress_eval($trust_main_matchs[2]); 126 if (file_exists($include_path)) 127 $this->external_define_path = $include_path; 151 128 } 152 } // end of for 129 130 // Check ImpressCMS 131 if (preg_match('/' . $impress_include_pattern . '/' ,$array_file[$i],$impres_matchs)){ 132 $this->is_impress = true; 133 $this->impress_db_config_file = $this->xoops_trust_path . $impres_matchs[2]; 134 } 135 } // end of for loop 136 } // end of if file_exists 137 138 // DB Config from Impress CMS impress_db_config file 139 if ($this->is_impress){ 140 if(file_exists($this->impress_db_config_file)){ 141 $array_file = file($this->impress_db_config_file); 142 $pattern = '^\s*define\s*\(\s*(\'[^\']+\'|"[^"]+")\s*,\s*(\'[^\']*\'|"[^"]*"|[^\'"])\s*\)\s*;'; 143 for ($i = 0 ; $i <count($array_file) ; $i++){ 144 if (preg_match('/' . $pattern . '/' ,$array_file[$i],$matchs)){ 145 $keys = $matchs[1]; 146 if (preg_match('/^\'[^\']*\'$/',$keys)) $keys = preg_replace('/\'/', '', $keys); 147 if (preg_match('/^"[^"]*"$/',$keys)) $keys = preg_replace('/"/', '', $keys); 148 $key_value = $matchs[2]; 149 150 switch ($keys){ 151 case 'SDATA_DB_SALT': 152 $this->xoops_db_salt = $this->xpress_eval($key_value); 153 break; 154 case 'SDATA_DB_PREFIX': 155 $this->xoops_db_prefix = $this->xpress_eval($key_value); 156 break; 157 case 'SDATA_DB_NAME': 158 $this->xoops_db_name = $this->xpress_eval($key_value); 159 break; 160 case 'SDATA_DB_USER': 161 $this->xoops_db_user = $this->xpress_eval($key_value); 162 break; 163 case 'SDATA_DB_PASS': 164 $this->xoops_db_pass = $this->xpress_eval($key_value); 165 break; 166 case 'SDATA_DB_HOST': 167 $this->xoops_db_host = $this->xpress_eval($key_value); 168 break; 169 default : 170 171 } // end of switch 172 } 173 } // end of for 174 } // end of if file_exists 175 } // end ofImpress CMS 176 177 // DB Config from external define file 178 if(!empty($this->external_define_path)){ 179 if(file_exists($this->external_define_path)){ 180 require_once($this->external_define_path); 181 182 $this->xoops_root_path = XOOPS_ROOT_PATH; 183 $this->xoops_url = XOOPS_URL; 184 $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 185 if(defined('XOOPS_TRUST_PATH')) $this->xoops_trust_path = XOOPS_TRUST_PATH; else $this->xoops_trust_path = ''; 186 $this->xoops_db_prefix = XOOPS_DB_PREFIX; 187 $this->xoops_db_name = XOOPS_DB_NAME; 188 $this->xoops_db_user = XOOPS_DB_USER; 189 $this->xoops_db_pass = XOOPS_DB_PASS; 190 $this->xoops_db_host = XOOPS_DB_HOST; 191 if(defined('XOOPS_DB_SALT')) $this->xoops_db_salt = XOOPS_DB_SALT; else $this->xoops_db_salt = ''; 192 if(defined('XOOPS_SALT')) $this->xoops_salt = XOOPS_SALT; else $this->xoops_salt = ''; 193 } // end of if file_exists 153 194 } 154 195 } 196 155 197 156 198 // define from /settings/definition.inc.php (XCL) or /include/common.php(2016a-JP)
Note: See TracChangeset
for help on using the changeset viewer.