$name"));
}else{
return (sprintf(_("This '%s' object will be deleted: %s"),$type, "
$name"));
}
}
if (count($name) == 1){
if($type == ""){
return (_("This object will be deleted:")."
".msgPool::buildList($name));
}else{
return (sprintf(_("This '%s' object will be deleted:"),$type, "
".msgPool::buildList($name)));
}
}
if($type == ""){
return (sprintf(_("These objects will be deleted: %s"), "
".msgPool::buildList($name)));
}else{
return (sprintf(_("These '%s' objects will be deleted: %s"),$type, "
".msgPool::buildList($name)));
}
}
public static function permDelete($name= "")
{
if ($name == "") {
return (_("You have no permission to delete this object!"));
}
if (!is_array($name)){
return (_("You have no permission to delete the object:")."
$name");
}
if (count($name) == 1){
return (_("You have no permission to delete the object:")."
".msgPool::buildList($name));
}
return (_("You have no permission to delete these objects:")."
".msgPool::buildList($name));
}
public static function permCreate($name= "")
{
if ($name == "") {
return (_("You have no permission to create this object!"));
}
if (!is_array($name)){
return (_("You have no permission to create the object:")."
$name");
}
if (count($name) == 1){
return (_("You have no permission to create the object:")."
".msgPool::buildList($name));
}
return (_("You have no permission to create these objects:")."
".msgPool::buildList($name));
}
public static function permModify($name= "")
{
if ($name == "") {
return (_("You have no permission to modify this object!"));
}
if (!is_array($name)){
return (_("You have no permission to modify the object:")."
$name");
}
if (count($name) == 1){
return (_("You have no permission to modify the object:")."
".msgPool::buildList($name));
}
return (_("You have no permission to modify these objects:")."
".msgPool::buildList($name));
}
public static function permView($name= "")
{
if ($name == "") {
return (_("You have no permission to view this object!"));
}
if (!is_array($name)){
return (_("You have no permission to view the object:")."
$name");
}
if (count($name) == 1){
return (_("You have no permission to view the object:")."
".msgPool::buildList($name));
}
return (_("You have no permission to view these objects:")."
".msgPool::buildList($name));
}
public static function permMove($name= "")
{
if ($name == "") {
return (_("You have no permission to move this object!"));
}
if (!is_array($name)){
return (_("You have no permission to move the object:")."
$name");
}
if (count($name) == 1){
return (_("You have no permission to move the object:")."
".msgPool::buildList($name));
}
return (_("You have no permission to move these objects:")."
".msgPool::buildList($name));
}
public static function dbconnect($name, $error= "", $dbinfo= "")
{
if ($error != ""){
$error= "
"._("Error").": ".$error;
}
if ($dbinfo != ""){
$error.= "
"._("Connection information").": ".$dbinfo;
}
return (sprintf(_("Cannot connect to %s database!"), $name).$error);
}
public static function dbselect($name, $error= "", $dbinfo= "")
{
if ($error != ""){
$error= "
"._("Error").": ".$error;
}
if ($dbinfo != ""){
$error.= "
"._("Connection information").": ".$dbinfo;
}
return (sprintf(_("Cannot select %s database!"), $name).$error);
}
public static function noserver($name)
{
return (sprintf(_("No %s server defined!"), $name));
}
public static function dbquery($name, $error= "", $dbinfo= "")
{
if ($error != ""){
$error= "
"._("Error").": ".$error;
}
if ($dbinfo != ""){
$error.= "
"._("Connection information").": ".$dbinfo;
}
return (sprintf(_("Cannot query %s database!"), $name).$error);
}
public static function reserved($name)
{
return (sprintf(_("The field '%s' contains a reserved keyword!"), $name));
}
public static function cmdnotfound($type, $plugin)
{
return (sprintf(_("Command specified as %s hook for plugin '%s' does not exist!"), $type, $plugin));
}
public static function toobig($name, $min= "")
{
if ($min == ""){
return (sprintf(_("Value for '%s' is too large!"), $name));
} else {
return (sprintf(_("'%s' must be smaller than %d!"), $name, $min));
}
}
public static function toosmall($name, $min= "")
{
if ($min == ""){
return (sprintf(_("Value for '%s' is too small!"), $name));
} else {
return (sprintf(_("'%s' must be %d or above!"), $name, $min));
}
}
public static function depends($name1, $name2)
{
return (sprintf(_("'%s' depends on '%s' - please provide both values!"), $name1, $name2));
}
public static function duplicated($name)
{
return (sprintf(_("There is already an entry with this '%s' attribute in the system!"), $name));
}
public static function required($name)
{
return (sprintf(_("The required field '%s' is empty!"), $name));
}
public static function invalid($name, $data= "", $regex= "", $example= "")
{
/* Stylize example */
if ($example != ""){
$example= "
"._("Example").": ".$example;
}
/* If validChars are posted, take data and paint all invalid
characters... */
if ($regex) {
$result= "";
$mismatch= "";
foreach (str_split($data) as $currentChar){
if (preg_match("$regex", $currentChar)){
$result.= $currentChar;
} else {
$result.= "".htmlentities($currentChar)."";
$mismatch.= $currentChar;
}
}
return sprintf(_("The Field '%s' contains invalid characters"), $name).". ".
(strlen($mismatch)==1?sprintf(_("'%s' is not allowed:"), htmlentities($mismatch)):sprintf(_("'%s' are not allowed."), htmlentities($mismatch))).
"
\"$result\"$example";
} else {
return sprintf(_("The Field '%s' contains invalid characters"), $name)."!$example";
}
}
public static function missingext($name)
{
return sprintf(_("Missing %s PHP extension!"), $name);
}
public static function cancelButton()
{
return sprintf(_("Cancel"));
}
public static function okButton()
{
return sprintf(_("Ok"));
}
public static function applyButton()
{
return sprintf(_("Apply"));
}
public static function saveButton()
{
return sprintf(_("Save"));
}
public static function addButton($what= "")
{
return $what == "" ? sprintf(_("Add")): sprintf(_("Add %s"), $what);
}
public static function delButton($what= "")
{
return $what == "" ? sprintf(_("Delete")): sprintf(_("Delete %s"), $what);
}
public static function setButton($what= "")
{
return $what == "" ? sprintf(_("Set")): sprintf(_("Set %s"), $what);
}
public static function editButton($what= "")
{
return $what == "" ? sprintf(_("Edit...")): sprintf(_("Edit %s..."), $what);
}
public static function backButton($what= "")
{
return $what == "" ? sprintf(_("Back...")): sprintf(_("Back %s..."), $what);
}
public static function buildList($data)
{
$objects= "";
foreach ($data as $key => $value){
if (is_numeric($key)){
$objects.= "
\n$value";
} else {
$objects.= "
\n$value ($key)";
}
}
}
public static function noValidExtension($name)
{
return sprintf(_("This account has no valid %s extensions!"), $name);
}
public static function featuresEnabled($name, $depends= "")
{
if ($depends == ""){
return sprintf(_("This account has %s settings enabled. You can disable them by clicking below."), $name);
} else {
if (count($depends) == 1){
return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $name, $depends);
} else {
$deps= "";
foreach ($depends as $dep){
$deps.= "$dep / ";
}
$deps= preg_replace("/ \/ $/", "", $deps);
return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $name, $deps);
}
}
}
public static function featuresDisabled($name, $depends= "")
{
if ($depends == ""){
return sprintf(_("This account has %s settings disabled. You can enable them by clicking below."), $name);
} else {
if (count($depends) == 1){
return sprintf(_("This account has %s settings disabled. To enable them, you'll need to add the %s settings first!"), $name, $depends);
} else {
$deps= "";
foreach ($depends as $dep){
$deps.= "$dep / ";
}
$deps= preg_replace("/ \/ $/", "", $deps);
return sprintf(_("This account has %s features settings. To disable them, you'll need to add the %s settings first!"), $name, $deps);
}
}
}
public static function addFeaturesButton($name)
{
return sprintf(_("Add %s settings"), $name);
}
public static function removeFeaturesButton($name)
{
return sprintf(_("Remove %s settings"), $name);
}
public static function clickEditToChange()
{
return _("Click the 'Edit' button below to change informations in this dialog");
}
public static function months()
{
return array(_("January"), _("February"), _("March"), _("April"),
_("May"), _("June"), _("July"), _("August"), _("September"),
_("October"), _("November"), _("December"));
}
public static function weekdays()
{
return array( _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday"));
}
public static function ldaperror($error, $dn= "", $type= 0, $plugin= "")
{
/* Assign headline depending on type */
$typemap= array(1 => _("read operation"), _("add operation"), _("modify operation"),
_("delete operation"), _("search operation"), _("authentication"));
if (isset($typemap[$type])){
$headline= sprintf(_("LDAP %s failed!"), $typemap[$type]);
} else {
$headline= _("LDAP operation failed!");
}
/* Fill DN information */
if ($dn != ""){
$dn_info= "
"._("Object").": ".LDAP::fix($dn);
}
return $headline.$dn_info."
"._("Error").": ".$error;
}
function incorrectUpload($reason= "")
{
if ($reason == ""){
return _("Upload failed!");
}
return sprintf(_("Upload failed: %s"), "
$reason");
}
}
?>