ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

context_set_configs.php
Go to the documentation of this file.
1 <?php
2
3 /*
4 * This source code is a part of the Ultimix Project.
5 * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6 * it's own license wich could be found from the corresponding files or sources.
7 * This source code is provided "as is" without any warranties or garanties.
8 *
9 * Have a nice day!
10 *
11 * @url http://ultimix.sorceforge.net
12 *
13 * @author Alexey "gdever" Dodonov
14 */
15
26 class context_set_configs_1_0_0{
27
38 var $CachedMultyFS = false;
39 var $ContextSetConfig = false;
40 var $Trace = false;
41
56 function __construct()
57 {
58 try
59 {
60 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
61 $this->ContextSetConfig = get_package_object( 'settings::settings' , 'last' , __FILE__ );
62 $this->Trace = get_package( 'trace' , 'last' , __FILE__ );
63 }
64 catch( Exception $e )
65 {
66 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
67 }
68 }
69
92 function load_context_set_config( &$ContextSetSettings , &$Options , $FilePath )
93 {
94 try
95 {
96 $FileName = $Options->get_setting( 'common_settings_config' , 'cfcxs_context_set' );
97 $FilePath = dirname( $FilePath )."/conf/$FileName";
98
99 if( $this->CachedMultyFS->file_exists( $FilePath ) )
100 {
101 $File = $this->CachedMultyFS->file_get_contents( $FilePath );
102 $this->Trace->add_trace_string( '{lang:common_settings_config} : '.$File , COMMON );
103 $ContextSetSettings->load_settings( $File );
104 }
105 }
106 catch( Exception $e )
107 {
108 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
109 }
110 }
111
146 function get_common_state_config( &$Settings , $SettingName , $Default , $ComponentPath )
147 {
148 try
149 {
150 $Message = "{lang:attempt_to_load_config} : \"$SettingName\" or default \"$Default\"";
151
152 $this->Trace->add_trace_string( $Message , COMMON );
153
154 $Config = $Settings->get_setting( $SettingName , $Default );
155
156 $this->Trace->add_trace_string( "{lang:searching_file} : \"$Config\"" , COMMON );
157
158 $Path = dirname( $ComponentPath )."/conf/$Config";
159
160 if( $this->CachedMultyFS->file_exists( $Path ) === false )
161 {
162 return( false );
163 }
164
165 $Config = $this->CachedMultyFS->file_get_contents( $Path );
166
167 $Config = str_replace( '{prefix}' , $Settings->get_setting( 'prefix' , '' ) , $Config );
168
169 return( $Config );
170 }
171 catch( Exception $e )
172 {
173 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
174 }
175 }
176
211 function load_common_state_config( &$Settings , $SettingName , $Default , $ComponentPath )
212 {
213 try
214 {
215 $Config = $this->get_common_state_config( $Settings , $SettingName , $Default , $ComponentPath );
216
217 $Config = get_package_object( 'settings::settings' , 'last' , __FILE__ );
218
219 $Config->load_settings( $Config );
220
221 return( $Config );
222 }
223 catch( Exception $e )
224 {
225 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
226 }
227 }
228
255 function get_context_set_prefix( $PackageName , $PackageVersion = 'last' )
256 {
257 try
258 {
259 $this->ContextSetConfig->clear();
260
261 $FilePath = _get_package_relative_path_ex( $PackageName , $PackageVersion ).'/unexisting_script';
262
263 $this->load_context_set_config( $this->ContextSetConfig , $this->ContextSetConfig , $FilePath );
264
265 return( $this->ContextSetConfig->get_setting( 'prefix' ) );
266 }
267 catch( Exception $e )
268 {
269 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
270 }
271 }
272
299 function get_context_permits( $Context , $PackageName , $PackageVersion = 'last' )
300 {
301 try
302 {
303 $this->ContextSetConfig->clear();
304
305 $FilePath = _get_package_relative_path_ex( $PackageName , $PackageVersion ).'/unexisting_script';
306
307 $this->load_context_set_config( $this->ContextSetConfig , $this->ContextSetConfig , $FilePath );
308
309 $CommonStateConfig = $this->load_common_state_config(
310 $this->ContextSetConfig , 'common_state_config_'.$Context.'_form' ,
311 'cfcxs_'.$Context.'_form' , $FilePath
312 );
313
314 $PermitsFilter = $CommonStateConfig->get_setting( 'permits_filter' , 'admin' );
315 return( $CommonStateConfig->get_setting( 'permits_validation' , $PermitsFilter ) );
316 }
317 catch( Exception $e )
318 {
319 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
320 }
321 }
322 }
323
324 ?>