From: Pádraic B. <mau...@ho...> - 2005-09-03 13:41:31
|
For those remaining in the config file - I have a few rambled entries somewhere (I have a library of notes and stuff somewhere) about pushing the config file into an class. Basically the idea talks about getting config values into a game's object model. It suggests composing the config file as a class - typically an object with properties, and various 'getter' methods. It is only a suggestion - I think my thinking at the time was to remove any non-essential variable setting that occured, and use an object to store config data instead. Therefore avoid passing config data around using globals or constants that might be open to interference. As a class, config data can be completely secured from outside influence short of someone actually editing the file. For the sake of illustration, such a class would be similar to: <?php // php4 version class ConfigurationData { var $root = '/path/to/basedir'; // list of all config vars written by install process function ConfigurationData() {} // singleton instantiation method (only one class ever instantiated, regardless of number of calls function &getInstance() { static $thisInstance; if($thisInstance == null) { $thisInstance = new ConfigurationData(); } return $thisInstance; } // getter method for ConfigurationData::root function getRoot() { return $this->root; } } ?> Usage: $config = ConfigurationData::getInstance(); require_once($config->getRoot() . '/core/classes/example.class.php'); It looks nicer in PHP5...without the reference &'s littering the singleton, being able to declare static properties, etc. To be honest the past few months PHP4 has been pushing back what I can do in QS. I'm looking forward to more widespread PHP5 adoption. Just thought I'd throw this out as a FYI. In QS3, and the next SR version, I expect pretty much all data to be encapsulated in objects per the MVC model. It's also looking like both games will start arriving in both PHP4 and PHP5 variants for future compatibility (PHP4 versions will be 'dumbed' down enough to work - the PHP5 version will be more secure and less error prone. Another FYI, eh? In PHP5, each property would be private (cannot be set outside a class method - and there will be no setter methods). In either version, you would include config data using the usage example from within any class requiring access to the data. Therefore, no globals, or constants, etc. that may be insecure. Another MtR copyrighted ramble ;) -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- Pádraic Brady aka Maugrim The Reaper http://www.quantum-star.com/ http://www.shadowsrising.net/ -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- >From: ProgrammerMatt <pro...@gm...> >To: Pádraic Brady <mau...@ho...> >Subject: Re: [Shadowsrising-cvs] >shadowsrising/install/themes/Default/templates config_fo >Date: Fri, 2 Sep 2005 16:13:55 -0500 > >Well, you see the problem is I cannot decide if I want to rewrite the >installer or modify the current one. A lot of options have been moved out >of >the config.inc.php file and into the database and I want to add >Update|Uninstall|etc functionality. > >But right now it is more important that I get qcms back up and running. It >isn't going excellent. Good news, my new, fully class based approach has >somehow cut 600 Kb of memory overhead, so common.inc.php now only has 1.6 >Mb >memory used when it is done, much better than 3 weeks ago @ 2.2 Mb and 6 >weeks ago @ 3.1 Mb > > >On 9/2/05, Pádraic Brady <mau...@ho...> wrote: > > > > A little evil is good...;) > > > > -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- > > Pádraic Brady > > > > aka Maugrim The Reaper > > http://www.quantum-star.com/ > > http://www.shadowsrising.net/ > > -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- > > > > > > > > > > >From: Matt Mix <pro...@us...> > > >To: sha...@li... > > >Subject: [Shadowsrising-cvs] > > shadowsrising/install/themes/Default/templates > > >config_form_finish.tpl.html,1.1,NONE config_form.tpl.html,1.8,NONE > > >location.tpl.html,1.1,NONE passwd_form.tpl.html,1.1,NONE > > >server_install_bottom.tpl.html,1.1,NONE > > >server_install_top.tpl.html,1.1,NONE >server_option_form.tpl.html,1.1,NONE > > >system_message2.tpl.html,1.1,NONE > > >Date: Fri, 02 Sep 2005 01:07:29 +0000 > > > > > >Update of > > >/cvsroot/shadowsrising/shadowsrising/install/themes/Default/templates > > >In directory > > > > > >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26042/install/themes/Default/templates > > > > > >Removed Files: > > > config_form_finish.tpl.html config_form.tpl.html > > > location.tpl.html passwd_form.tpl.html > > > server_install_bottom.tpl.html server_install_top.tpl.html > > > server_option_form.tpl.html system_message2.tpl.html > > >Log Message: > > >this installer buisness is just evil, just evil > > > > > > > > >--- system_message2.tpl.html DELETED --- > > > > > >--- config_form_finish.tpl.html DELETED --- > > > > > >--- location.tpl.html DELETED --- > > > > > >--- passwd_form.tpl.html DELETED --- > > > > > >--- server_option_form.tpl.html DELETED --- > > > > > >--- config_form.tpl.html DELETED --- > > > > > >--- server_install_top.tpl.html DELETED --- > > > > > >--- server_install_bottom.tpl.html DELETED --- > > > > > > > > > > > >------------------------------------------------------- > > >SF.Net email is Sponsored by the Better Software Conference & EXPO > > >September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > Practices > > >Agile & Plan-Driven Development * Managing Projects & Teams * Testing & > > QA > > >Security * Process Improvement & Measurement * >http://www.sqe.com/bsce5sf > > >_______________________________________________ > > >Shadowsrising-cvs mailing list > > >Sha...@li... > > >https://lists.sourceforge.net/lists/listinfo/shadowsrising-cvs > > > > > > |