Changeset 549 for branches/1.1dev/config
- Timestamp:
- Oct 2, 2015 9:02:39 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/config/boot.inc.php
r423 r549 23 23 define('SITE_BASE', '__NO_SITE_BASE__'); 24 24 } 25 25 26 26 /****************************************************************************** 27 27 * INCLUDE GLOBAL LIBRARIES AND CONFIGURATIONS … … 57 57 // MySQL connection parameters. 58 58 if (!empty($_SERVER['DB_NAME']) && !empty($_SERVER['DB_USER']) && !empty($_SERVER['DB_PASS'])) { 59 // We set DB passwords as environment variables in the httpd.conf file, 59 // We set DB passwords as environment variables in the httpd.conf file, 60 60 // which is readable only by root. 61 61 $CFG->database = $_SERVER['DB_NAME']; … … 70 70 include SITE_BASE . '/../config/db_auth.inc.php'; 71 71 } 72 72 73 73 if (empty($CFG->database) || empty($CFG->username) || !isset($CFG->password)) { // Allow password to be empty string. 74 74 logMsg('Database credentials missing.', LOG_WARNING, __FILE__, __LINE__); 75 75 } 76 76 77 77 // Connect to MySQL 78 78 if ($dbh = mysql_connect('localhost', $CFG->username, $CFG->password)) { 79 79 // Select database 80 mysql_select_db($CFG->database, $dbh); 80 mysql_select_db($CFG->database, $dbh); 81 81 } 82 82 … … 104 104 { 105 105 global $CFG, $dbh; 106 106 107 107 $debugqry = preg_replace("/\n[\t ]+/", "\n", $query); 108 108 if ($CFG->db_always_debug || $debug) { 109 logMsg($debugqry, LOG_DEBUG, __FILE__, __LINE__); 109 110 echo "<!-- --------------------------------------\n" . $debugqry . "\n-->"; 110 111 } 111 112 // Ensure we have an active connection. 112 113 // Ensure we have an active connection. 113 114 // If we continue on a dead connection we might experience a "MySQL server has gone away" error. 114 115 // http://dev.mysql.com/doc/refman/5.0/en/gone-away.html … … 118 119 mysql_close($dbh); 119 120 if ($dbh = mysql_connect('localhost', $CFG->username, $CFG->password)) { 120 mysql_select_db($CFG->database, $dbh); 121 mysql_select_db($CFG->database, $dbh); 121 122 } 122 123 if (!$dbh || mysql_error($dbh)) { … … 149 150 return $qid; 150 151 } 151 152 152 153 $mysql_character_sets = array( 153 154 'utf-8' => 'utf8', 154 155 'iso-8859-1' => 'latin1', 155 156 ); 156 157 157 158 // Tell MySQL what character set we're useing. Available only on MySQL verions > 4.01.01. 158 159 if ('' != $CFG->character_set && isset($mysql_character_sets[strtolower($CFG->character_set)])) { … … 168 169 *****************************************************************************/ 169 170 170 171 171 172 // Skip sessions for some scripts, like the cron executed scripts. 172 173 if (true === $CFG->enable_session) { //________________________________________ … … 177 178 session_id($ses); 178 179 } 179 180 180 181 // Session parameters. 181 182 ini_set('session.use_cookies', $CFG->session_use_cookies); … … 197 198 session_set_save_handler('mysqlSessionOpen', 'mysqlSessionClose', 'mysqlSessionRead', 'mysqlSessionWrite', 'mysqlSessionDestroy', 'mysqlSessionGarbage'); 198 199 } 199 200 200 201 // Start the session. Access session data using: $_SESSION['...'] 201 202 session_start(); … … 209 210 // if (getGet(session_name())) { 210 211 // logMsg(sprintf('Found session in get: %s=%s', session_name(), getGet(session_name())), LOG_DEBUG, __FILE__, __LINE__); 211 // } 212 // } 212 213 // logMsg(sprintf('Using session %s=%s', session_name(), session_id()), LOG_DEBUG, __FILE__, __LINE__); 213 214 214 215 215 216 /****************************************************************************** 216 217 * LANGUAGE 217 218 *****************************************************************************/ 218 219 219 220 // Set the language. 220 221 if ($lang = getFormData('lang')) { … … 269 270 header('X-Codebase-Version: ' . $CFG->codebase_version); 270 271 } 271 272 272 273 // Capture the ultimate referrer. Used? Not yet. 273 274 if (!isset($_SESSION['_ultimate_referrer'])) { … … 279 280 $inc_lang = isset($_SESSION['_language']) ? $_SESSION['_language'] : 'en'; 280 281 ini_set('include_path', 281 ini_get('include_path') . PATH_SEPARATOR . 282 ini_get('include_path') . PATH_SEPARATOR . 282 283 SITE_BASE . '/_templates/' . $inc_lang . PATH_SEPARATOR . 283 284 CODE_BASE . '/templates/' . $inc_lang . PATH_SEPARATOR . 284 285 285 286 SITE_BASE . '/_templates/en' . PATH_SEPARATOR . 286 287 CODE_BASE . '/templates/en' . PATH_SEPARATOR . 287 288 288 289 SITE_BASE . '/_templates' . PATH_SEPARATOR . 289 290 CODE_BASE . '/templates'
Note: See TracChangeset
for help on using the changeset viewer.