* api documentation finished for common.inc.php and directories.php
This commit is contained in:
Jan Dittberner 2007-12-02 22:11:59 +00:00
parent 9f722b7c68
commit f6be78bdcf
3 changed files with 39 additions and 15 deletions

View file

@ -65,14 +65,20 @@ if (!is_dir($compile_dir)) {
}
$smarty->compile_dir = $compile_dir;
/** Handle invalid requests to the application. */
/**
* Handle invalid requests to the application. Execution stops here.
*/
function invalidCall() {
header("Content-Type: text/plain; charset=UTF-8");
print(_("Invalid call!"));
die();
}
/** Handle errors with an XML message. */
/**
* Handle errors with an XML message. Execution stops here.
*
* @param string $errormsg error message
*/
function errorAsXml($errormsg) {
header("Content-Type: text/xml; charset=UTF-8");
$GLOBALS['smarty']->assign("errormsg", $errormsg);
@ -80,7 +86,11 @@ function errorAsXml($errormsg) {
die();
}
/** Handle errors with an HTML error page. */
/**
* Handle errors with an HTML error page. Execution stops here.
*
* @param string $errormsg error msg
*/
function errorAsHtml($errormsg) {
header("Content-Type: text/html; charset=UTF-8");
$GLOBALS['smarty']->assign("errormsg", $errormsg);
@ -88,6 +98,13 @@ function errorAsHtml($errormsg) {
die();
}
/**
* Get the full path of relative directory name.
*
* @param string $dirname directory name relative to configured
* $davconfig['dav.dir']
* @return string fully qualified directory name
*/
function getFullPath($dirname) {
return $GLOBALS['davconfig']['dav.dir'] . DIRECTORY_SEPARATOR . $dirname;
}
@ -139,7 +156,14 @@ if (!empty($errmsgs)) {
errorAsHtml(implode("<br />", $errmsgs));
}
function cmp_by_usernames($user1, $user2) {
/**
* Compares two associative arrays of userdata by their username value.
*
* @param array &$user1 user data one
* @param array &$user2 user data two
* @return value of strcmp of the username values
*/
function cmp_by_usernames(&$user1, &$user2) {
return strcmp($user1['username'], $user2['username']);
}