Commit 124cbe9c authored by Penny Leach's avatar Penny Leach

more work on init, beginnings of mahara lib

parent 555047e1
<?php
/**
* This file is part of maraha.
* Copyright 2006,2007 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* maraha is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* maraha is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with maraha; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* This file is part of maraha.
*
* maraha is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* maraha is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with maraha; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// set up basic error handling here
......@@ -27,17 +29,41 @@ $CFG->docroot = dirname(__FILE__);
// figure out our include path
$CFG->libroot = dirname(dirname(__FILE__)).'/lib/';
if (array_key_exists('MAHARA_LIBDIR',$_SERVER) && !empty($_SERVER['MAHARA_LIBDIR'])) {
$CFG->libroot = $_SERVER['MAHARA_LIBDIR'];
$CFG->libroot = $_SERVER['MAHARA_LIBDIR'];
}
set_include_path('.'.PATH_SEPARATOR.$CFG->libroot);
if (!file_exists($CFG->libroot.'config.php') || !is_readable($CFG->libroot.'config.php')) {
throw new Exception("Not installed! Please create config.php from config-dist.php");
throw new Exception("Not installed! Please create config.php from config-dist.php");
}
require('config.php');
$CFG = (object)array_merge((array)$cfg,(array)$CFG);
require('mahara.php');
ensure_config_sanity();
ensure_php_sanity();
require('adodb/adodb.inc.php'); // Database access functions
$db = &ADONewConnection($CFG->dbtype);
ob_start();
if (!empty($CFG->dbport)) {
$CFG->dbhost .= ':'.$CFG->dbhost;
}
if (!isset($CFG->dbpersist) or !empty($CFG->dbpersist)) { // Use persistent connection (default)
$dbconnected = $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname);
} else { // Use single connection
$dbconnected = $db->Connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname);
}
if (empty($dbconnected)) {
$errormessage = ob_get_contents();
ob_end_clean();
throw new Exception("Database connection failed with error: ".$db->ErrorMsg()." (".$errormessage.")");
}
ob_end_clean();
?>
\ No newline at end of file
<?php
/**
* Copyright 2006,2007 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This file is part of maraha.
*
* maraha is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* maraha is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with maraha; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
function ensure_config_sanity() {
}
function ensure_php_sanity() {
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment