[SPT/CWIS] URL overrides of SysConfig
Kucera, Rich
Kucerar at hhmi.org
Wed Apr 30 09:38:07 CDT 2008
Hello,
Is there an easy way to override some of the settings in $SysConfig from
values given in the URL?
Below is a patch to do that. I needed to be able to change the UI/Theme
without having to log in and without having to set the entire default UI to
the target UI. (Once control is passed to the target UI, all links can add
the override, keeping the system returning to that UI without a login).
For example:
http://server.nonprofit.org/someDB/SPT--Home.php?DefaultActiveUI=SPTUI--SOMED
B&CurrentTheme=Theme--Droplets&ForumsEnabled=false
Thanks,
-Rich
p.s.
class SystemConfiguration {
# ---- PUBLIC INTERFACE
--------------------------------------------------
# object constructor
function SystemConfiguration($DB = NULL)
{
# load current system config info from database
$this->DB =& new SPTDatabase();
$this->DB->Query("SELECT * FROM SystemConfiguration");
$Record = $this->DB->FetchRow();
$this->DBFields = $Record;
//rjk
//Override initial config parameter in URL (this was mainly done for UI
changes
//to be able to control UI/Theme by URL entry points instead of just
one default UI).
//Once control is in the custom UI, whatever view it is, can add
the URL values
//to all links generated within that UI customization to keep
returning to that UI.
//It's a way to get to a custom UI without having to log in as a user
and without
//having to set the entire default UI to that UI.
foreach( $this->DBFields as $config_name => $config_val ) {
if ( $_REQUEST [ $config_name ] ) {
$new_config_val = $_REQUEST [ $config_name ];
if ( $new_config_val == 'true' ) $new_config_val = 1;
if ( $new_config_val == 'false' ) $new_config_val =
0;
$Record[ $config_name ] = $new_config_val;
}
}
$this->TopLinkString = stripslashes($Record["TopLinkString"]);
$this->TopLinkBeginLetter =
stripslashes($Record["TopLinkBeginLetter"]);
$this->TopLinkEndLetter = stripslashes($Record["TopLinkEndLetter"]);
$this->AdminEmail = stripslashes($Record["AdminEmail"]);
$this->PasswordMailSubject =
stripslashes($Record["PasswordMailSubject"]);
$this->PasswordMailBody = stripslashes($Record["PasswordMailBody"]);
$this->PortalName = stripslashes($Record["PortalName"]);
$this->DefaultActiveUI = stripslashes($Record["DefaultActiveUI"]);
$this->CurrentTheme = stripslashes($Record["CurrentTheme"]);
...
More information about the SPT-CWIS-Users
mailing list