From: <se...@us...> - 2007-06-21 05:24:11
|
Revision: 12459 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12459&view=rev Author: segalz Date: 2007-06-20 22:24:07 -0700 (Wed, 20 Jun 2007) Log Message: ----------- Test subclasses; add conf.php. Modified Paths: -------------- branches/GSoC-config/squirrelmail/config/config_class.php Added Paths: ----------- branches/GSoC-config/squirrelmail/config/conf.php Added: branches/GSoC-config/squirrelmail/config/conf.php =================================================================== --- branches/GSoC-config/squirrelmail/config/conf.php (rev 0) +++ branches/GSoC-config/squirrelmail/config/conf.php 2007-06-21 05:24:07 UTC (rev 12459) @@ -0,0 +1,27 @@ +<?php + +/** + * SquirrelMail Configuration File + * Created using the configure script, conf.pl + */ + +//$config_version = '1.5.0'; +$this->config_use_color = 2; + +$this->org_name = "SQM-GSoC"; +$this->org_logo = SM_PATH . 'images/sm_logo.png'; +$this->org_logo_width = '308'; +$this->org_logo_height = '111'; + +$org_title = "SquirrelMail"; + +$this->signout_page = ''; +$this->frame_top = '_top'; + +$provider_uri = ''; + +$provider_name = "wacka"; + +$motd = ""; + +$squirrelmail_default_language = 'en_US'; Modified: branches/GSoC-config/squirrelmail/config/config_class.php =================================================================== --- branches/GSoC-config/squirrelmail/config/config_class.php 2007-06-21 03:34:11 UTC (rev 12458) +++ branches/GSoC-config/squirrelmail/config/config_class.php 2007-06-21 05:24:07 UTC (rev 12459) @@ -1264,4 +1264,61 @@ } -} \ No newline at end of file +} + +class SQMConfigFile extends SQMConfig { + +function SQMConfigFile($confFile) { + +/** + * calculate SM_PATH and calculate the base_uri + * assumptions made: init.php is only called from plugins or from the src dir. + * files in the plugin directory may not be part of a subdirectory called "src" + * + */ +if (isset($_SERVER['SCRIPT_NAME'])) { + $a = explode('/',$_SERVER['SCRIPT_NAME']); +} elseif (isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) { + $a = explode('/',$HTTP_SERVER_VARS['SCRIPT_NAME']); +} else { + $error = 'Unable to detect script environment. ' + .'Please test your PHP settings and send PHP core config, $_SERVER ' + .'and $HTTP_SERVER_VARS to SquirrelMail developers.'; + die($error); +} +$sSM_PATH = ''; +for($i = count($a) -2;$i > -1; --$i) { + $sSM_PATH .= '../'; + if ($a[$i] === 'src' || $a[$i] === 'plugins') { + break; + } +} + +$base_uri = implode('/',array_slice($a,0,$i)). '/'; + +define('SM_PATH',$sSM_PATH); +define('SM_BASE_URI', $base_uri); +require(SM_PATH . 'conf.php'); + +} + +} + +class SQMConfigDB extends SQMConfig { + +} + +//$sqmConfc = new SQMConfigDB("db uri"); + +$sqmConfa = new SQMConfigFile("conf.php"); + +$sqmConfb = new SQMConfig; + +print "file org_name: '$sqmConfa->org_name'\n"; +print "default org_name: '$sqmConfb->org_name'\n"; +print "file org_title: '$sqmConfa->org_title'\n"; +print "default org_title: '$sqmConfb->org_title'\n"; + +/* php4 lacks encapsulation for member vars */ +$sqmConfb->org_title = "SQMSQM"; +print "modified org_title: '$sqmConfb->org_title'\n"; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |