- initial import
This commit is contained in:
commit
5e60bf4a9a
37 changed files with 2204 additions and 0 deletions
75
admin/common.inc.php
Normal file
75
admin/common.inc.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* Common code for WebDAVAdmin.
|
||||
*
|
||||
* @author Jan Dittberner <jan@dittberner.info>
|
||||
* @version $Id$
|
||||
* @license GPL
|
||||
* @package WebDAVAdmin
|
||||
*
|
||||
* Copyright (c) 2007 Jan Dittberner
|
||||
*
|
||||
* This file is part of WebDAVAdmin.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/** Include configuration information. */
|
||||
require_once('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();
|
||||
|
||||
/** Handle invalid requests to the application. */
|
||||
function invalidCall() {
|
||||
header("Content-Type: text/plain; charset=UTF-8");
|
||||
print("Ungültiger Aufruf!");
|
||||
die();
|
||||
}
|
||||
|
||||
/** Handle errors with an XML message. */
|
||||
function errorAsXml($errormsg) {
|
||||
header("Content-Type: text/xml; charset=UTF-8");
|
||||
$GLOBALS['smarty']->assign("errormsg", $errormsg);
|
||||
$GLOBALS['smarty']->display("error.xml");
|
||||
die();
|
||||
}
|
||||
|
||||
/** Handle errors with an HTML error page. */
|
||||
function errorAsHtml($errormsg) {
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
$GLOBALS['smarty']->assign("errormsg", $errormsg);
|
||||
$GLOBALS['smarty']->display("error.html");
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a PDO statement error.
|
||||
*
|
||||
* @param PDOStatement $sth statement handle
|
||||
*/
|
||||
function statementErrorAsXml(&$sth) {
|
||||
errorAsXml(utf8_encode(implode("\n", $sth->errorInfo())));
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue