* @author Sam Blum * @version 4.5.$Revision: 1.4 $ $Date: 2003/10/29 17:47:02 $ * @package / * @see blueshoes.ini.php * @copyright blueshoes.org * * * DISCLAIMER This code is provided to you, "as is". Best efforts have been made to * maintain it, but the authors are not responsible for the results of any defects * that may be found to exist, or any lost profits or other consequential damages * that may result from such defects. You should not assume that this code is * error-free or that it will be suitable for the particular purpose that you have * in mind when using it. */ /************************************************************************* * At this early stage, we need to know if we are on a Windows system. * Mainly because of path stuff. * @see Bs_System for more system funciton. */ $_isWindows = (strToLower(substr(PHP_OS,0,3)) === 'win'); /** * $_SERVER['DOCUMENT_ROOT'] is not alway ending with a slash '/' because some ppl just * don't add the slash at the end of the htdoc dir-path (what we think is a bad habit). */ $_sdrChar = substr($_SERVER['DOCUMENT_ROOT'], -1); if (('/' !== $_sdrChar) OR ('\\' !== $_sdrChar)) $_SERVER['DOCUMENT_ROOT'] .= '/'; /************************************************************************* * BS-ROOT check * Check BS-ROOT. Look for BS-ROOT path in following order: * 1) If $APP['path']['bsRoot'] is already set (and not '') use it. * 2) ELSE If we detect a 'bs-n.n'-pattern in the $_SERVER['DOCUMENT_ROOT'] * then assume the BS-ROOT to be '/usr/local/lib/php/blueshoes-n.n/' * E.g. $_SERVER['DOCUMENT_ROOT'] == /var/www/sites-bs-4.3/xxx.testsite.local/ * Then $APP['path']['bsRoot'] == '/usr/local/lib/php/blueshoes-4.3/' * X) ELSE if none above, die with FATAL error. */ if (empty($APP['path']['bsRoot'])) { $APP['path']['bsRoot'] = ''; // Set the full path to BS-ROOT here.(read text above to know if you have to set it) if (empty($APP['path']['bsRoot'])) { if (preg_match('/bs-(\d\.\d{1,2})/', $_SERVER['DOCUMENT_ROOT'], $match)) { $APP['path']['bsRoot'] = "/usr/local/lib/php/blueshoes-{$match[1]}/"; } else { $out = 'No PHP_BSROOT path given for Blue Shoes lib!'."\n"; $out .='Please set environment variable PHP_BSROOT or the $APP[\'path\'][\'bsRoot\'] variable in this file '.__FILE__."\n"; echo nl2br($out); user_error($out, E_USER_ERROR); } } } // On Windows: take away and leading 'C:' (Disklettre) if (($_isWindows) AND ($APP['path']['bsRoot'][1] !== ':')) { $APP['path']['bsRoot'] = substr(__FILE__,0,2) . $APP['path']['bsRoot']; } /************************************************************************* * Set PHP logging default for BS * $APP['log']['error_reporting'] = E_ALL; // Set which PHP errors are to be tracked e.g. E_ALL ^ E_NOTICE. See "Error Handling" in PHP doc * $APP['log']['display_errors'] = TRUE; // Print out errors as a part of the output * $APP['log']['log_errors'] = TRUE; // Turn file/syslog logging: on (true) or off (false) * $APP['log']['error_log'] = $_SERVER['DOCUMENT_ROOT'] . '../log/bs_ErrLog.txt'; // File to log into. If set to 'syslog' logs to syslog (Event Log on NT, not valid in Windows 95) * * Please use PHP's internal logging function: user_error(string error_msg [, int error_type]) * error_type's are E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR. * Formats are given by PHP (unchangeable) * NOTE: * E_USER_NOTICE and E_USER_WARNING will log and process will continue. * E_USER_ERROR will log and immediately STOP(!) execution with 'Fatal error'. */ if ($_isWindows) { //dev machine $APP['log']['error_reporting'] = E_ALL; $APP['log']['display_errors'] = TRUE; # $APP['log']['log_errors'] = FALSE; # $APP['log']['error_log'] = $_SERVER['DOCUMENT_ROOT'] . '../bs_log/bs_PhpErrLog.txt'; } else { //live machine $APP['log']['error_reporting'] = E_ALL ^ E_NOTICE; $APP['log']['display_errors'] = FALSE; $APP['log']['log_errors'] = TRUE; $APP['log']['error_log'] = $_SERVER['DOCUMENT_ROOT'] . '../bs_log/bs_PhpErrLog.txt'; } foreach($APP['log'] as $key => $val) { if (is_bool($val)) $val = ($val) ? '1' : '0'; if (is_string($val) AND $val=='') continue; // Ignore empty string ini_set($key, $val); } /************************************************************************* * BS INIT Include the bs init file holding all defaults. */ include_once($APP['path']['bsRoot'] . 'blueshoes.ini.php'); /************************************************************************* * SESSION * * maxLifetime (int) Independent of use, invalidat after this time (im min). * 0 means until browser end. * * maxStandbyTime (int) How long should the session stay valid (in min) since last access. * 0 means until browser end. * * gc (int): garbage collection. On how many % of the newly created sessions * the garbage collector should be started. * * garbage_lifetime (int) The age (in min) that a session file may have befor * it's assumed garbage and is deleted. This value must be larger then * maxLifetime. If set to 0, no garbage is collected. * * --- Following are *only* used by Bs_Session --- * ------------------------------------------------------------------------------------------ * tags (vector): which tags to rewrite if in querystring mode. * they are, and default is all of them: * a eg * area eg * frame eg * input eg * form eg
* meta eg * header eg Header("Location: URL") //special case, not a tag. * we cannot deal with javascript. sorry. php ppl say it would * need AI and thus nearly cannot be done, at least not reliable. * * domains (vector): which domains to rewrite if in querystring mode. default is array(). * normally only relative url's can be rewritten because otherwise * we would pass along the session id to foreign websites, and we * don't want that. here you can name your domains to which the * rewrite should apply aswell. * examples: * domain.com (applies to domain.com but not to www.domain.com) * www.domain.com (applies not to domain.com or us.domain.com) * *.domain.com (applies to ANY-OR-NOTHING.domain.com) * 150.140.130.120 (applies to exactly this ip) * so a wildcard * is only allowed on the left side of a domain name. * * tech (int) tells how we identify the user. * * the var name that is used in querystring name or as cookie name is defined in * the session class (see below). */ // Following are used by Bs_SimpleSession and Bs_Session $APP['sess']['path'] = $_SERVER['DOCUMENT_ROOT'] . '../session/'; $APP['sess']['maxLifeTime'] = 0; $APP['sess']['maxStandbyTime'] = 180; $APP['sess']['gc'] = 1; $APP['sess']['garbage_lifetime'] = 60*240; // Default to 10 days // Following are *only* used by Bs_Session $APP['sess']['tags'] = array('a', 'area', 'frame', 'input', 'form', 'meta', 'header'); $APP['sess']['domains'] = array(); $APP['sess']['tech'] = 0; /************************************************************************* * BROWSCAP * * use (bool): use browscap at all? TRUE or FALSE. * sess must be in use aswell, otherwise it makes *no* sense. * * strict (bool): be strict with needed features? TRUE or FALSE. * if set to true, then the client browser must report all features to * be explicitly available. if one is not known, bad luck. otherwise a * "not known" is interpreted as "ok, let's try". * * check (array): [not in use yet.] * which features to check (using bool values): * - speed the connection speed * - flash the plugin shockwave-flash * - pdf the plugin acrobat */ $APP['browscap']['use'] = FALSE; $APP['browscap']['strict'] = FALSE; $APP['browscap']['check']['speed'] = FALSE; $APP['browscap']['check']['flash'] = FALSE; $APP['browscap']['check']['pdf'] = FALSE; /************************************************************************* * BS CACHE * * 'version' For internal use mainly. Used when PHP sources change and all cache-sources are * no longer valid. We either have to delete all cache-sources or set the * 'version' to a new value. Any value != old value will do, so just ++ the number. * * xstore == Bs_XStorage * 'xstoreON' If TRUE the data tha XAtom will be cached. */ $APP['cache']['version'] = 5; // Used when PHP sources change $APP['cache']['xstoreOn'] = FALSE; // Turn persistent XATOM-caching ON/OFF $APP['cache']['map']['xxs'] = 5; // 5 secs the mappings $APP['cache']['map']['xs'] = 60; // 1 min are used $APP['cache']['map']['s'] = 300; // 5 mins to map $APP['cache']['map']['m'] = 3600; // 1 hour names to $APP['cache']['map']['l'] = 10800; // 3 hours # seconds. $APP['cache']['map']['xl'] = 43200; // 12 hours $APP['cache']['map']['xxl'] = 86400; // 24 hours /************************************************************************* * WWW */ $APP['domainName'] = 'localhost'; //... /************************************************************************* * COLORS, FONTS, STYLES */ //$APP['defaultFontFace'] = 'arial, helvetica'; //... /************************************************************************* * WEBMASTER */ $APP['emailWebmaster'] = 'not@specified'; $APP['emailSysop'] = 'not@specified'; /************************************************************************* * USED LANGUAGES * the first one is the general fallback. * the value can be 2-9 characters. the first 2 is the iso-something code (see kb). * if you need more, add a dash - as the 3rd character. then you have * 6 more chars to use. some ideas are: 'en-uk', 'en-us', 'de-du', ... * this system is used everywhere. the forms for example offer you to type the * captions in the languages specified here. */ $APP['usedLanguages'] = array('en'); //array('de', 'de-du', 'en-uk', 'fr-ch') ... /************************************************************************* * DB * 'name' => db name 'pass' => letmein * 'host' => localhost 'socket' => a unix socket * 'port' => 6667 'syntax' => mysql * 'user' => root 'type' => mysql * note: we need both syntax and type because for example * there could be a type 'odbc' with syntax 'access'. */ $APP['db']['main']['name'] = ''; $APP['db']['main']['host'] = 'localhost'; $APP['db']['main']['port'] = '3306'; $APP['db']['main']['user'] = 'root'; $APP['db']['main']['pass'] = ''; $APP['db']['main']['socket'] = ''; $APP['db']['main']['syntax'] = 'mysql'; $APP['db']['main']['type'] = 'mysql'; /************************************************************************* * DB * Yes, a similar code as in *.conf.php. * 'name' => db name 'pass' => letmein * 'host' => localhost 'socket' => a unix socket * 'port' => 6667 'syntax' => mysql * 'user' => root 'type' => mysql * note: we need both syntax and type because for example * there could be a type 'odbc' with syntax 'access'. */ ########################################### # BlueShoes Connection Stuff ########################################### $APP['db']['admin']['name'] = 'bs_admin'; $APP['db']['admin']['host'] = 'localhost'; $APP['db']['admin']['port'] = '3306'; $APP['db']['admin']['user'] = 'root'; $APP['db']['admin']['pass'] = ''; $APP['db']['admin']['socket'] = ''; $APP['db']['admin']['syntax'] = 'mysql'; $APP['db']['admin']['type'] = 'mysql'; $APP['db']['ecg']['name'] = 'bs_ecg'; $APP['db']['ecg']['host'] = 'localhost'; $APP['db']['ecg']['port'] = '3306'; $APP['db']['ecg']['user'] = 'root'; $APP['db']['ecg']['pass'] = ''; $APP['db']['ecg']['socket'] = ''; $APP['db']['ecg']['syntax'] = 'mysql'; $APP['db']['ecg']['type'] = 'mysql'; ########################################### # MySql default ########################################### $APP['db']['mySql']['name'] = 'test'; $APP['db']['mySql']['host'] = 'localhost'; $APP['db']['mySql']['port'] = '3306'; $APP['db']['mySql']['user'] = 'root'; $APP['db']['mySql']['pass'] = ''; $APP['db']['mySql']['socket'] = ''; $APP['db']['mySql']['syntax'] = 'mysql'; $APP['db']['mySql']['type'] = 'mysql'; #################################################################### # If you like you can open up the primary MySql DB connection # that is then available everywhere... :) #################################################################### if (FALSE) { include_once($APP['path']['core'] . 'db/Bs_MySql.class.php'); $bsDb =& new Bs_MySql(); $connId = $bsDb->connect($APP['db']['mySql']); if (isEx($connId)) { //crap. $connId->stackTrace('', __FILE__, __LINE__, 'fatal'); $connId->stackDump('alert'); echo 'check your db, honey!'; die(); } else { $GLOBALS['bsDb'] = &$bsDb; } } /************************************************************************* * Create The Session * */ $sessionType = ''; //if you use this, then 'simple' is the recommended one. switch ($sessionType) { case 'simple': require_once($APP['path']['core'] . 'net/http/session/Bs_SimpleSession.class.php'); $GLOBALS['bsSession']=& $GLOBALS['Bs_SimpleSession']; break; case 'file': //deprecated require_once($APP['path']['core'] . 'net/http/session/Bs_SessionFile.class.php'); $GLOBALS['bsSession']=& new Bs_SessionFile($APP['path']['session']); $GLOBALS['bsSession']->start(); break; default: // No session } /************************************************************************* * Start browscap detection */ if ($APP['browscap']['use']) bsSessionBrowscap(); ?>