directories are working
users still have dependencies to database code
This commit is contained in:
Jan Dittberner 2007-11-21 23:00:58 +00:00
parent 5e60bf4a9a
commit 7bffc8bf97
12 changed files with 168 additions and 183 deletions

View file

@ -27,19 +27,27 @@
* 02110-1301 USA.
*/
if (!isset($_SERVER['DavAdminConfDir'])) {
header('HTTP/1.0 500 Internal Server Error');
header('Status: 500 Internal Server Error');
header('Content-Type: text/plain;charset=utf8');
print("The Server is not configured correctly. " .
"Please tell your Administrator to set the " .
"DavAdminConfDir environment variable.");
exit();
}
/** Include configuration information. */
require_once('config.inc.php');
require_once($_SERVER['DavAdminConfDir'] . '/config.inc.php');
/** DAV administrator group name. */
define(ADMIN_GROUP, 'davadmin');
/** DAV administration application subdirectory. */
define(ADMIN_DIR, 'admin');
/** Include the Smarty template engine. */
require_once("smarty/libs/Smarty.class.php");
/** Global Smarty template engine instance. */
$smarty = new Smarty();
$smarty->compile_dir = $davconfig['compile_dir'];
/** Handle invalid requests to the application. */
function invalidCall() {
@ -64,12 +72,47 @@ function errorAsHtml($errormsg) {
die();
}
/**
* Handle a PDO statement error.
*
* @param PDOStatement $sth statement handle
*/
function statementErrorAsXml(&$sth) {
errorAsXml(utf8_encode(implode("\n", $sth->errorInfo())));
function getFullPath($dirname) {
return $GLOBALS['davconfig']['dav.dir'] . DIRECTORY_SEPARATOR . $dirname;
}
// check configuration
$errmsgs = array();
if (!isset($davconfig['digest.file'])) {
array_push($errmsgs, 'digest.file not defined');
} elseif (!is_readable($davconfig['digest.file']) ||
!is_writable($davconfig['digest.file'])) {
array_push($errmsgs,
'The specified digest file is not readable and writable.');
}
if (!isset($davconfig['group.file'])) {
array_push($errmsgs, 'group.file not defined');
} elseif (!is_readable($davconfig['group.file']) ||
!is_writable($davconfig['group.file'])) {
array_push($errmsgs,
'The specified group file is not readable and writable.');
}
if (!isset($davconfig['namemap.file'])) {
array_push($errmsgs, 'namemap.file not defined');
} elseif (!is_readable($davconfig['namemap.file']) ||
!is_writable($davconfig['namemap.file'])) {
array_push($errmsgs,
'The specified name mapping file is not readable and writable.');
}
if (!isset($davconfig['dav.dir'])) {
array_push($errmsgs, 'dav.dir not defined');
} elseif (!is_dir($davconfig['dav.dir']) ||
!is_readable($davconfig['dav.dir']) ||
!is_writable($davconfig['dav.dir'])) {
array_push($errmsgs,
'The specified DAV directory is no directory or not accessable.');
}
if (!empty($errmsgs)) {
errorAsHtml(implode("<br />", $errmsgs));
}
$namemap = json_decode(readfile($davconfig['namemap.file']), true);
if ($namemap === NULL) {
$namemap = array();
}
?>