Code

Updated property editor.
[gosa.git] / gosa-core / include / functions.inc
index cbcc4a46e321f3bbf949392ad2557c98279cbba8..76d422f3e8741e7e225f19528338b601200bf527 100644 (file)
@@ -124,14 +124,14 @@ function __gosa_autoload($class_name) {
     global $class_mapping, $BASE_DIR;
 
     if ($class_mapping === NULL){
-           echo sprintf(_("Fatal error: no class locations defined - please run '%s' to fix this"), "<b>update-gosa</b>");
+           echo sprintf(_("Fatal error: no class locations defined - please run %s to fix this"), bold("update-gosa"));
            exit;
     }
 
     if (isset($class_mapping["$class_name"])){
       require_once($BASE_DIR."/".$class_mapping["$class_name"]);
     } else {
-      echo sprintf(_("Fatal error: cannot instantiate class '%s' - try running '%s' to fix this"), $class_name, "<b>update-gosa</b>");
+      echo sprintf(_("Fatal error: cannot instantiate class %s - try running %s to fix this"), bold($class_name), bold("update-gosa"));
       exit;
     }
 }
@@ -203,7 +203,7 @@ function make_seed() {
  * */
 function DEBUG($level, $line, $function, $file, $data, $info="")
 {
-  if (session::global_get('DEBUGLEVEL') & $level){
+  if (session::global_get('debugLevel') & $level){
     $output= "DEBUG[$level] ";
     if ($function != ""){
       $output.= "($file:$function():$line) - $info: ";
@@ -245,8 +245,8 @@ function get_browser_language()
   }
 
   /* Check for global language settings in gosa.conf */
-  if (isset ($config) && $config->get_cfg_value('language') != ""){
-    $lang = $config->get_cfg_value('language');
+  if (isset ($config) && $config->get_cfg_value("core",'language') != ""){
+    $lang = $config->get_cfg_value("core",'language');
     if(!preg_match("/utf/i",$lang)){
       $lang .= ".UTF-8";
     }
@@ -308,7 +308,7 @@ function get_template_path($filename= '', $plugin= FALSE, $path= "")
 
   /* Set theme */
   if (isset ($config)){
-       $theme= $config->get_cfg_value("theme", "default");
+       $theme= $config->get_cfg_value("core","theme", "default");
   } else {
        $theme= "default";
   }
@@ -445,7 +445,7 @@ function ldap_init ($server, $base, $binddn='', $pass='')
   /* Sadly we've no proper return values here. Use the error message instead. */
   if (!$ldap->success()){
     msg_dialog::display(_("Fatal error"),
-        sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error()),
+        sprintf(_("Error while connecting to LDAP: %s"), $ldap->get_error()),
         FATAL_ERROR_DIALOG);
     exit();
   }
@@ -466,7 +466,7 @@ function process_htaccess ($username, $kerberos= FALSE)
   
     $config->set_current($name);
     $mode= "kerberos";
-    if ($config->get_cfg_value("useSaslForKerberos") == "true"){
+    if ($config->get_cfg_value("core","useSaslForKerberos") == "true"){
       $mode= "sasl";
     }
 
@@ -516,7 +516,7 @@ function ldap_login_user_htaccess ($username)
   $ldap->search("(&(objectClass=gosaAccount)(uid=$username))", array("uid"));
   /* Found no uniq match? Strange, because we did above... */
   if ($ldap->count() != 1) {
-    msg_dialog::display(_("LDAP error"), _("Username / UID is not unique inside the LDAP tree!"), FATAL_ERROR_DIALOG);
+    msg_dialog::display(_("LDAP error"), _("User ID is not unique!"), FATAL_ERROR_DIALOG);
     return (NULL);
   }
   $attrs= $ldap->fetch();
@@ -570,8 +570,8 @@ function ldap_login_user ($username, $password)
   $ldap->cd($config->current['BASE']);
   $allowed_attributes = array("uid","mail");
   $verify_attr = array();
-  if($config->get_cfg_value("loginAttribute") != ""){
-    $tmp = explode(",", $config->get_cfg_value("loginAttribute")); 
+  if($config->get_cfg_value("core","loginAttribute") != ""){
+    $tmp = explode(",", $config->get_cfg_value("core","loginAttribute")); 
     foreach($tmp as $attr){
       if(in_array($attr,$allowed_attributes)){
         $verify_attr[] = $attr;
@@ -602,7 +602,7 @@ function ldap_login_user ($username, $password)
 
             /* found more than one matching id */
     default:
-            msg_dialog::display(_("Internal error"), _("Username / UID is not unique inside the LDAP tree. Please contact your Administrator."), FATAL_ERROR_DIALOG);
+            msg_dialog::display(_("Internal error"), _("User ID is not unique!"), FATAL_ERROR_DIALOG);
             return (NULL);
   }
 
@@ -789,17 +789,17 @@ function add_lock($object, $user)
 
   /* Just a sanity check... */
   if ($object == "" || $user == ""){
-    msg_dialog::display(_("Internal error"), _("Error while adding a lock. Contact the developers!"), ERROR_DIALOG);
+    msg_dialog::display(_("Internal error"), _("Error while locking entry!"), ERROR_DIALOG);
     return;
   }
 
   /* Check for existing entries in lock area */
   $ldap= $config->get_ldap_link();
-  $ldap->cd ($config->get_cfg_value("config"));
+  $ldap->cd ($config->get_cfg_value("core","config"));
   $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=".base64_encode($object)."))",
       array("gosaUser"));
   if (!$ldap->success()){
-    msg_dialog::display(_("Configuration error"), sprintf(_("Cannot create locking information in LDAP tree. Please contact your administrator!")."<br><br>"._('LDAP server returned: %s'), "<br><br><i>".$ldap->get_error()."</i>"), ERROR_DIALOG);
+    msg_dialog::display(_("Configuration error"), sprintf(_("Cannot store lock information in LDAP!")."<br><br>"._('Error: %s'), "<br><br><i>".$ldap->get_error()."</i>"), ERROR_DIALOG);
     return;
   }
 
@@ -807,14 +807,14 @@ function add_lock($object, $user)
   if ($ldap->count() == 0){
     $attrs= array();
     $name= md5($object);
-    $ldap->cd("cn=$name,".$config->get_cfg_value("config"));
+    $ldap->cd("cn=$name,".$config->get_cfg_value("core","config"));
     $attrs["objectClass"] = "gosaLockEntry";
     $attrs["gosaUser"] = $user;
     $attrs["gosaObject"] = base64_encode($object);
     $attrs["cn"] = "$name";
     $ldap->add($attrs);
     if (!$ldap->success()){
-      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "cn=$name,".$config->get_cfg_value("config"), 0, ERROR_DIALOG));
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "cn=$name,".$config->get_cfg_value("core","config"), 0, ERROR_DIALOG));
       return;
     }
   }
@@ -856,7 +856,7 @@ function del_lock ($object)
 
   /* Check for existance and remove the entry */
   $ldap= $config->get_ldap_link();
-  $ldap->cd ($config->get_cfg_value("config"));
+  $ldap->cd ($config->get_cfg_value("core","config"));
   $ldap->search ("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaObject"));
   $attrs= $ldap->fetch();
   if ($ldap->getDN() != "" && $ldap->success()){
@@ -883,7 +883,7 @@ function del_user_locks($userdn)
 
   /* Get LDAP ressources */ 
   $ldap= $config->get_ldap_link();
-  $ldap->cd ($config->get_cfg_value("config"));
+  $ldap->cd ($config->get_cfg_value("core","config"));
 
   /* Remove all objects of this user, drop errors silently in this case. */
   $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$userdn))", array("gosaUser"));
@@ -907,7 +907,7 @@ function get_lock ($object)
 
   /* Sanity check */
   if ($object == ""){
-    msg_dialog::display(_("Internal error"), _("Error while adding a lock. Contact the developers!"), ERROR_DIALOG);
+    msg_dialog::display(_("Internal error"), _("Error while locking entry!"), ERROR_DIALOG);
     return("");
   }
 
@@ -917,7 +917,7 @@ function get_lock ($object)
   /* Get LDAP link, check for presence of the lock entry */
   $user= "";
   $ldap= $config->get_ldap_link();
-  $ldap->cd ($config->get_cfg_value("config"));
+  $ldap->cd ($config->get_cfg_value("core","config"));
   $ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaUser"));
   if (!$ldap->success()){
     msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_SEARCH, ERROR_DIALOG));
@@ -927,9 +927,6 @@ function get_lock ($object)
   /* Check for broken locking information in LDAP */
   if ($ldap->count() > 1){
 
-    /* Hmm. We're removing broken LDAP information here and issue a warning. */
-    msg_dialog::display(_("Warning"), _("Found multiple locks for object to be locked. This should not happen - cleaning up multiple references."), WARNING_DIALOG);
-
     /* Clean up these references now... */
     while ($attrs= $ldap->fetch()){
       $ldap->rmdir($attrs['dn']);
@@ -970,7 +967,7 @@ function get_multiple_locks($objects)
   /* Get LDAP link, check for presence of the lock entry */
   $user= "";
   $ldap= $config->get_ldap_link();
-  $ldap->cd ($config->get_cfg_value("config"));
+  $ldap->cd ($config->get_cfg_value("core","config"));
   $ldap->search($filter, array("gosaUser","gosaObject"));
   if (!$ldap->success()){
     msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_SEARCH, ERROR_DIALOG));
@@ -1054,7 +1051,7 @@ function get_sub_list($filter, $category,$sub_deps, $base= "", $attributes= arra
       // log($action,$objecttype,$object,$changes_array = array(),$result = "") 
       new log("debug","all",__FILE__,$attributes,
           sprintf("get_sub_list(): Falling back to get_list(), due to empty sub_bases parameter.".
-            " This may slow down GOsa. Search was: '%s'",$filter));
+            " This may slow down GOsa. Used filter: %s", $filter));
     }
     $tmp = get_list($filter, $category,$base,$attributes,$flags);
     return($tmp);
@@ -1232,9 +1229,9 @@ function check_sizelimit()
   /* Eventually show dialog */
   if (session::is_set('limit_exceeded') && session::get('limit_exceeded')){
     $smarty= get_smarty();
-    $smarty->assign('warning', sprintf(_("The size limit of %d entries is exceed!"),
+    $smarty->assign('warning', sprintf(_("The current size limit of %d entries is exceeded!"),
           session::global_get('size_limit')));
-    $smarty->assign('limit_message', sprintf(_("Set the new size limit to %s and show me this message if the limit still exceeds"), '<input type="text" name="new_limit" maxlength="10" size="5" value="'.(session::global_get('size_limit') +100).'">'));
+    $smarty->assign('limit_message', sprintf(_("Set the size limit to %s"), '<input type="text" name="new_limit" maxlength="10" size="5" value="'.(session::global_get('size_limit') +100).'">'));
     return($smarty->fetch(get_template_path('sizelimit.tpl')));
   }
 
@@ -1246,12 +1243,12 @@ function print_sizelimit_warning()
 {
   if (session::global_is_set('size_limit') && session::global_get('size_limit') >= 10000000 ||
       (session::is_set('limit_exceeded') && session::get('limit_exceeded'))){
-    $config= "<input type='submit' name='edit_sizelimit' value="._("Configure").">";
+    $config= "<button type='submit' name='edit_sizelimit'>"._("Configure")."</button>";
   } else {
     $config= "";
   }
   if (session::is_set('limit_exceeded') && session::get('limit_exceeded')){
-    return ("("._("incomplete").") $config");
+    return ("("._("list is incomplete").") $config");
   }
   return ("");
 }
@@ -1441,8 +1438,8 @@ function get_ou($name)
                 "mimetypeRDN"    => "ou=mime,");
 
   /* Preset ou... */
-  if ($config->get_cfg_value($name, "_not_set_") != "_not_set_"){
-    $ou= $config->get_cfg_value($name);
+  if ($config->get_cfg_value("core",$name, "_not_set_") != "_not_set_"){
+    $ou= $config->get_cfg_value("core",$name);
   } elseif (isset($map[$name])) {
     $ou = $map[$name];
     return($ou);
@@ -1538,7 +1535,7 @@ function strict_uid_mode()
   global $config;
 
   if (isset($config)){
-    return ($config->get_cfg_value("strictNamingRules") == "true");
+    return ($config->get_cfg_value("core","strictNamingRules") == "true");
   }
   return (TRUE);
 }
@@ -1629,15 +1626,7 @@ function gen_locked_message($user, $dn, $allow_readonly = FALSE)
   /* Prepare and show template */
   $smarty= get_smarty();
   $smarty->assign("allow_readonly",$allow_readonly);
-  if(is_array($dn)){
-    $msg = "<pre>";
-    foreach($dn as $sub_dn){
-      $msg .= "\n".$sub_dn.", ";
-    }
-    $msg = preg_replace("/, $/","</pre>",$msg);
-  }else{
-    $msg = $dn;
-  }
+  $msg= msgPool::buildList($dn);
 
   $smarty->assign ("dn", $msg);
   if ($remove){
@@ -1645,7 +1634,8 @@ function gen_locked_message($user, $dn, $allow_readonly = FALSE)
   } else {
     $smarty->assign ("action", _("Edit anyway"));
   }
-  $smarty->assign ("message", sprintf(_("You're going to edit the LDAP entry/entries %s"), "<b>".$msg."</b>", ""));
+
+  $smarty->assign ("message", _("These entries are currently locked:"). $msg);
 
   return ($smarty->fetch (get_template_path('islocked.tpl')));
 }
@@ -1907,18 +1897,6 @@ function range_selector($dcnt,$start,$range=25,$post_var=false)
 }
 
 
-/*! \brief Generate HTML for the 'Apply filter' button */
-function apply_filter()
-{
-  $apply= "";
-
-  $apply= ''.
-    '<table summary=""  width="100%"  style="background:#EEEEEE;border-top:1px solid #B0B0B0;"><tr><td width="100%" align="right">'.
-    '<input type="submit" name="apply" value="'._("Apply filter").'"></td></tr></table>';
-
-  return ($apply);
-}
-
 
 /*! \brief Generate HTML for the 'Back' button */
 function back_to_main()
@@ -2223,38 +2201,6 @@ function in_array_ics($value, $items)
 }
 
 
-/*! \brief Generate a clickable alphabet */
-function generate_alphabet($count= 10)
-{
-  $characters= _("*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
-  $alphabet= "";
-  $c= 0;
-
-  /* Fill cells with charaters */
-  for ($i= 0, $l= mb_strlen($characters, 'UTF8'); $i<$l; $i++){
-    if ($c == 0){
-      $alphabet.= "<tr>";
-    }
-
-    $ch = mb_substr($characters, $i, 1, "UTF8");
-    $alphabet.= "<td><a class=\"alphaselect\" href=\"main.php?plug=".
-      validate($_GET['plug'])."&amp;search=".$ch."\">&nbsp;".$ch."&nbsp;</a></td>";
-
-    if ($c++ == $count){
-      $alphabet.= "</tr>";
-      $c= 0;
-    }
-  }
-
-  /* Fill remaining cells */
-  while ($c++ <= $count){
-    $alphabet.= "<td>&nbsp;</td>";
-  }
-
-  return ($alphabet);
-}
-
-
 /*! \brief Removes malicious characters from a (POST) string. */
 function validate($string)
 {
@@ -2272,7 +2218,7 @@ function get_gosa_version()
 
   /* Release or development? */
   if (preg_match('%/gosa/trunk/%', $svn_path)){
-    return (sprintf(_("GOsa development snapshot (Rev %s)"), $revision));
+    return (sprintf(_("GOsa development snapshot (Rev %s)"), bold($revision)));
   } else {
     $release= preg_replace('%^.*/([^/]+)/include/functions.inc.*$%', '\1', $svn_path);
     return (sprintf(_("GOsa $release"), $revision));
@@ -2369,7 +2315,7 @@ function clean_smarty_compile_dir($directory)
               is_writable($directory."/".$file)) {
             // delete file
             if(!unlink($directory."/".$file)) {
-              msg_dialog::display(_("Internal error"), sprintf(_("File '%s' could not be deleted."), $directory."/".$file), ERROR_DIALOG);
+              msg_dialog::display(_("Internal error"), sprintf(_("File %s cannot be deleted!"), bold($directory."/".$file)), ERROR_DIALOG);
               // This should never be reached
             }
           } elseif(is_dir($directory."/".$file) &&
@@ -2403,7 +2349,7 @@ function create_revision($revision_file, $revision)
     }
     fclose($fh);
   } else {
-    msg_dialog::display(_("Internal error"), _("Cannot write to revision file!"), ERROR_DIALOG);
+    msg_dialog::display(_("Internal error"), _("Cannot write revision file!"), ERROR_DIALOG);
   }
 
   return $result;
@@ -2423,7 +2369,7 @@ function compare_revision($revision_file, $revision)
         $result= true;
       }
     } else {
-      msg_dialog::display(_("Internal error"), _("Cannot write to revision file!"), ERROR_DIALOG);
+      msg_dialog::display(_("Internal error"), _("Cannot write revision file!"), ERROR_DIALOG);
     }
     // Close file
     fclose($fh);
@@ -2442,11 +2388,64 @@ function compare_revision($revision_file, $revision)
  * \param int 'percentage' Value to display
  * \param int 'width' width of the resulting output
  * \param int 'height' height of the resulting output
- * \param boolean 'showvalue' weither to show the percentage in the progressbar or not
+ * \param boolean 'showtext' weither to show the percentage in the progressbar or not
  * */
-function progressbar($percentage,$width=100,$height=15,$showvalue=false)
+function progressbar($percentage, $width= 200, $height= 14, $showText= false, $colorize= true, $id= "")
 {
-  return("<img src='progress.php?x=$width&amp;y=$height&amp;p=$percentage'>");
+  $text= "";
+  $class= "";
+  $style= "width:${width}px;height:${height}px;";
+
+  // Fix percentage range
+  $percentage= floor($percentage);
+  if ($percentage > 100) {
+    $percentage= 100;
+  }
+  if ($percentage < 0) {
+    $percentage= 0;
+  }
+
+  // Only show text if we're above 10px height
+  if ($showText && $height>10){
+    $text= $percentage."%";
+  }
+
+  // Set font size
+  $style.= "font-size:".($height-3)."px;";
+
+  // Set color
+  if ($colorize){
+    if ($percentage < 70) {
+      $class= " progress-low";
+    } elseif ($percentage < 80) {
+      $class= " progress-mid";
+    } elseif ($percentage < 90) {
+      $class= " progress-high";
+    } else {
+      $class= " progress-full";
+    }
+  }
+  
+  // Apply gradients
+  $hoffset= floor($height / 2) + 4;
+  $woffset= floor(($width+5) * (100-$percentage) / 100);
+  foreach (array("-moz-box-shadow", "-webkit-box-shadow", "box-shadow") as $type) {
+    $style.="$type:
+                   0 0 2px rgba(255, 255, 255, 0.4) inset,
+                   0 4px 6px rgba(255, 255, 255, 0.4) inset,
+                   0 ".$hoffset."px 0 -2px rgba(255, 255, 255, 0.2) inset,
+                   -".$woffset."px 0 0 -2px rgba(255, 255, 255, 0.2) inset,
+                   -".($woffset+1)."px 0 0 -2px rgba(0, 0, 0, 0.6) inset,
+                   0pt ".($hoffset+1)."px 8px rgba(0, 0, 0, 0.3) inset,
+                   0pt 1px 0px rgba(0, 0, 0, 0.2);";
+  }
+
+  // Set ID
+  if ($id != ""){
+    $id= "id='$id'";
+  }
+
+  return "<div class='progress$class' $id style='$style'>$text</div>";
 }
 
 
@@ -2628,10 +2627,10 @@ function get_base_from_hook($dn, $attrib)
 {
   global $config;
 
-  if ($config->get_cfg_value("baseIdHook") != ""){
+  if ($config->get_cfg_value("core","baseIdHook") != ""){
     
     /* Call hook script - if present */
-    $command= $config->get_cfg_value("baseIdHook");
+    $command= $config->get_cfg_value("core","baseIdHook");
 
     if ($command != ""){
       $command.= " '".LDAP::fix($dn)."' $attrib";
@@ -2642,17 +2641,17 @@ function get_base_from_hook($dn, $attrib)
           return ($output[0]);
         } else {
           msg_dialog::display(_("Warning"), _("'baseIdHook' is not available. Using default base!"), WARNING_DIALOG);
-          return ($config->get_cfg_value("uidNumberBase"));
+          return ($config->get_cfg_value("core","uidNumberBase"));
         }
       } else {
         msg_dialog::display(_("Warning"), _("'baseIdHook' is not available. Using default base!"), WARNING_DIALOG);
-        return ($config->get_cfg_value("uidNumberBase"));
+        return ($config->get_cfg_value("core","uidNumberBase"));
       }
 
     } else {
 
       msg_dialog::display(_("Warning"), _("'baseIdHook' is not available. Using default base!"), WARNING_DIALOG);
-      return ($config->get_cfg_value("uidNumberBase"));
+      return ($config->get_cfg_value("core","uidNumberBase"));
 
     }
   }
@@ -2675,7 +2674,7 @@ function check_schema($cfg,$rfc2307bis = FALSE)
   $ldap = new ldapMultiplexer(new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE, $cfg['tls']));
   $objectclasses = $ldap->get_objectclasses();
   if(count($objectclasses) == 0){
-    msg_dialog::display(_("LDAP warning"), _("Cannot get schema information from server. No schema check possible!"), WARNING_DIALOG);
+    msg_dialog::display(_("Warning"), _("Cannot read schema information from LDAP. Schema validation is not possible!"), WARNING_DIALOG);
   }
 
   /* This is the default block used for each entry.
@@ -2687,28 +2686,28 @@ function check_schema($cfg,$rfc2307bis = FALSE)
       "STATUS"           => FALSE,
       "IS_MUST_HAVE"     => FALSE,
       "MSG"              => "",
-      "INFO"             => "");#_("There is currently no information specified for this schema extension."));
+      "INFO"             => "");
 
   /* The gosa base schema */
   $checks['gosaObject'] = $def_check;
   $checks['gosaObject']['REQUIRED_VERSION'] = "2.6.1";
-  $checks['gosaObject']['SCHEMA_FILES']     = array("gosa-samba3.schema","gosa-samba2.schema");
+  $checks['gosaObject']['SCHEMA_FILES']     = array("gosa-samba3.schema");
   $checks['gosaObject']['CLASSES_REQUIRED'] = array("gosaObject");
   $checks['gosaObject']['IS_MUST_HAVE']     = TRUE;
 
   /* GOsa Account class */
   $checks["gosaAccount"]["REQUIRED_VERSION"]= "2.6.6";
-  $checks["gosaAccount"]["SCHEMA_FILES"]    = array("gosa-samba3.schema","gosa-samba2.schema");
+  $checks["gosaAccount"]["SCHEMA_FILES"]    = array("gosa-samba3.schema");
   $checks["gosaAccount"]["CLASSES_REQUIRED"]= array("gosaAccount");
   $checks["gosaAccount"]["IS_MUST_HAVE"]    = TRUE;
-  $checks["gosaAccount"]["INFO"]            = _("Used to store account specific informations.");
+  $checks["gosaAccount"]["INFO"]            = _("This class is used to make users appear in GOsa.");
 
   /* GOsa lock entry, used to mark currently edited objects as 'in use' */
   $checks["gosaLockEntry"]["REQUIRED_VERSION"] = "2.6.1";
-  $checks["gosaLockEntry"]["SCHEMA_FILES"]     = array("gosa-samba3.schema","gosa-samba2.schema");
+  $checks["gosaLockEntry"]["SCHEMA_FILES"]     = array("gosa-samba3.schema");
   $checks["gosaLockEntry"]["CLASSES_REQUIRED"] = array("gosaLockEntry");
   $checks["gosaLockEntry"]["IS_MUST_HAVE"]     = TRUE;
-  $checks["gosaLockEntry"]["INFO"]             = _("Used to lock currently edited entries to avoid multiple changes at the same time.");
+  $checks["gosaLockEntry"]["INFO"]             = _("This class is used to lock entries in order to prevent multiple edits at a time.");
 
   /* Some other checks */
   foreach(array(
@@ -2753,18 +2752,18 @@ function check_schema($cfg,$rfc2307bis = FALSE)
       if(!isset($objectclasses[$name])){
         if($value['IS_MUST_HAVE']){
           $checks[$name]['STATUS'] = FALSE;
-          $checks[$name]['MSG']    = sprintf(_("Missing required object class '%s'!"),$class);
+          $checks[$name]['MSG']    = sprintf(_("Required object class %s is missing!"), bold($class));
         } else {
           $checks[$name]['STATUS'] = TRUE;
-          $checks[$name]['MSG']    = sprintf(_("Missing optional object class '%s'!"),$class);
+          $checks[$name]['MSG']    = sprintf(_("Optional object class %s is missing!"), bold($class));
         }
       }elseif(!check_schema_version($objectclasses[$name],$value['REQUIRED_VERSION'])){
         $checks[$name]['STATUS'] = FALSE;
 
-        $checks[$name]['MSG'] = sprintf(_("Version mismatch for required object class '%s' (!=%s)!"), $class,                           $value['REQUIRED_VERSION']);
+        $checks[$name]['MSG'] = sprintf(_("Wrong version of required object class %s (!=%s) detected!"), bold($class), bold($value['REQUIRED_VERSION']));
       }else{
         $checks[$name]['STATUS'] = TRUE;
-        $checks[$name]['MSG'] = sprintf(_("Class(es) available"));
+        $checks[$name]['MSG'] = sprintf(_("Class available"));
       }
     }
   }
@@ -2786,13 +2785,13 @@ function check_schema($cfg,$rfc2307bis = FALSE)
 
     if($rfc2307bis && isset($tmp['posixGroup']['STRUCTURAL'])){
       $checks['posixGroup']['STATUS']           = FALSE;
-      $checks['posixGroup']['MSG']              = _("You have enabled the rfc2307bis option on the 'ldap setup' step, but your schema    configuration do not support this option.");
-      $checks['posixGroup']['INFO']             = _("In order to use rfc2307bis conform groups the objectClass 'posixGroup' must be      AUXILIARY");
+      $checks['posixGroup']['MSG']              = _("RFC 2307bis group schema is enabled, but the current LDAP configuration does not support it!");
+      $checks['posixGroup']['INFO']             = _("To use RFC 2307bis groups, the objectClass 'posixGroup' must be AUXILIARY.");
     }
     if(!$rfc2307bis && !isset($tmp['posixGroup']['STRUCTURAL'])){
       $checks['posixGroup']['STATUS']           = FALSE;
-      $checks['posixGroup']['MSG']              = _("Your schema is configured to support the rfc2307bis group, but you have disabled this option on the 'ldap setup' step.");
-      $checks['posixGroup']['INFO']             = _("The objectClass 'posixGroup' must be STRUCTURAL");
+      $checks['posixGroup']['MSG']              = _("RFC 2307bis group schema is disabled, but the current LDAP configuration supports it!");
+      $checks['posixGroup']['INFO']             = _("To correct this, the objectClass 'posixGroup' must be STRUCTURAL.");
     }
   }
 
@@ -2810,6 +2809,7 @@ function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FA
         "en_US" => "English",
         "nl_NL" => "Dutch",
         "pl_PL" => "Polish",
+        "pt_BR" => "Brazilian Portuguese",
         #"sv_SE" => "Swedish",
         "zh_CN" => "Chinese",
         "vi_VN" => "Vietnamese",
@@ -2823,6 +2823,7 @@ function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FA
         "en_US" => _("English"),
         "nl_NL" => _("Dutch"),
         "pl_PL" => _("Polish"),
+        "pt_BR" => _("Brazilian Portuguese"),
         #"sv_SE" => _("Swedish"),
         "zh_CN" => _("Chinese"),
         "vi_VN" => _("Vietnamese"),
@@ -2925,7 +2926,7 @@ function change_password ($dn, $password, $mode=0, $hash= "")
   // Get all available encryption Methods
 
   // NON STATIC CALL :)
-  $methods = new passwordMethod(session::get('config'));
+  $methods = new passwordMethod(session::get('config'),$dn);
   $available = $methods->get_available_methods();
 
   // read current password entry for $dn, to detect the encryption Method
@@ -2955,7 +2956,7 @@ function change_password ($dn, $password, $mode=0, $hash= "")
   } else {
     // User MD5 by default
     $hash= "md5";
-    $test = new  $available['md5']($config);
+    $test = new  $available['md5']($config, $dn);
   }
 
   if($test instanceOf passwordMethod){
@@ -3021,7 +3022,7 @@ function change_password ($dn, $password, $mode=0, $hash= "")
           @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
           exec($command);
         } else {
-          $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
+          $message= sprintf(_("Command %s specified as post modify action for plugin %s does not exist!"), bold($command), bold("password"));
           msg_dialog::display(_("Configuration error"), $message, ERROR_DIALOG);
         }
       }
@@ -3045,7 +3046,7 @@ function generate_smb_nt_hash($password)
   global $config;
 
   # Try to use gosa-si?
-  if ($config->get_cfg_value("gosaSupportURI") != ""){
+  if ($config->get_cfg_value("core","gosaSupportURI") != ""){
        $res= gosaSupportDaemon::send("gosa_gen_smb_hash", "GOSA", array("password" => $password), TRUE);
     if (isset($res['XML']['HASH'])){
        $hash= $res['XML']['HASH'];
@@ -3054,11 +3055,11 @@ function generate_smb_nt_hash($password)
     }
 
     if ($hash == "") {
-      msg_dialog::display(_("Configuration error"), _("Cannot generate samba hash!"), ERROR_DIALOG);
+      msg_dialog::display(_("Configuration error"), _("Cannot generate SAMBA hash!"), ERROR_DIALOG);
       return ("");
     }
   } else {
-         $tmp= $config->get_cfg_value('sambaHashHook')." ".escapeshellarg($password);
+         $tmp= $config->get_cfg_value("core",'sambaHashHook')." ".escapeshellarg($password);
          @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
 
          exec($tmp, $ar);
@@ -3067,7 +3068,7 @@ function generate_smb_nt_hash($password)
          $hash= current($ar);
 
     if ($hash == "") {
-      msg_dialog::display(_("Configuration error"), sprintf(_("Cannot generate samba hash: running '%s' failed, check the 'sambaHashHook'!"),$config->get_cfg_value('sambaHashHook')), ERROR_DIALOG);
+      msg_dialog::display(_("Configuration error"), sprintf(_("Generating SAMBA hash by running %s failed: check %s!"), bold($config->get_cfg_value("core",'sambaHashHook'), bold("sambaHashHook"))), ERROR_DIALOG);
       return ("");
     }
   }
@@ -3101,7 +3102,7 @@ function getEntryCSN($dn)
   }
 
   /* Get attribute that we should use as serial number */
-  $attr= $config->get_cfg_value("modificationDetectionAttribute");
+  $attr= $config->get_cfg_value("core","modificationDetectionAttribute");
   if($attr != ""){
     $ldap = $config->get_ldap_link();
     $ldap->cat($dn,array($attr));
@@ -3341,14 +3342,14 @@ function get_next_id($attrib, $dn)
 {
   global $config;
 
-  switch ($config->get_cfg_value("idAllocationMethod", "traditional")){
+  switch ($config->get_cfg_value("core","idAllocationMethod", "traditional")){
     case "pool":
       return get_next_id_pool($attrib);
     case "traditional":
       return get_next_id_traditional($attrib, $dn);
   }
 
-  msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("unknown idAllocation method!"), ERROR_DIALOG);
+  msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("unknown idAllocation method!"), ERROR_DIALOG);
   return null;
 }
 
@@ -3357,12 +3358,12 @@ function get_next_id_pool($attrib) {
   global $config;
 
   /* Fill informational values */
-  $min= $config->get_cfg_value("${attrib}PoolMin", 10000);
-  $max= $config->get_cfg_value("${attrib}PoolMax", 40000);
+  $min= $config->get_cfg_value("core","${attrib}PoolMin", 10000);
+  $max= $config->get_cfg_value("core","${attrib}PoolMax", 40000);
 
   /* Sanity check */
   if ($min >= $max) {
-    msg_dialog::display(_("Error"), _("Cannot allocate a free ID:")." ".sprintf(_("%sPoolMin >= %sPoolMax!"), $attrib), ERROR_DIALOG);
+    msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." ".sprintf(_("%sPoolMin >= %sPoolMax!"), bold($attrib), bold($attrib)), ERROR_DIALOG);
     return null;
   }
 
@@ -3381,8 +3382,8 @@ function get_next_id_pool($attrib) {
     /* If it does not exist, create one with these defaults */
     if ($ldap->count() == 0) {
       /* Fill informational values */
-      $minUserId= $config->get_cfg_value("uidPoolMin", 10000);
-      $minGroupId= $config->get_cfg_value("gidPoolMin", 10000);
+      $minUserId= $config->get_cfg_value("core","uidPoolMin", 10000);
+      $minGroupId= $config->get_cfg_value("core","gidPoolMin", 10000);
 
       /* Add as default */
       $attrs= array("objectClass" => array("organizationalUnit", "sambaUnixIdPool"));
@@ -3400,7 +3401,7 @@ function get_next_id_pool($attrib) {
     }
     /* Bail out if it's not unique */
     if ($ldap->count() != 1) {
-      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("sambaUnixIdPool is not unique!"), ERROR_DIALOG);
+      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("sambaUnixIdPool is not unique!"), ERROR_DIALOG);
       return null;
     }
 
@@ -3412,11 +3413,11 @@ function get_next_id_pool($attrib) {
 
     /* Sanity check */
     if ($newAttr >= $max) {
-      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("no ID available!"), ERROR_DIALOG);
+      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("no ID available!"), ERROR_DIALOG);
       return null;
     }
     if ($newAttr < $min) {
-      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("no ID available!"), ERROR_DIALOG);
+      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("no ID available!"), ERROR_DIALOG);
       return null;
     }
 
@@ -3431,7 +3432,7 @@ function get_next_id_pool($attrib) {
     $ldap->cd($dn);
     $ldap->modify(array($attrib => $newAttr));
     if ($ldap->error != "Success") {
-      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." ".$ldap->get_error(), ERROR_DIALOG);
+      msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." ".$ldap->get_error(), ERROR_DIALOG);
       return null;
     } else {
       return $oldAttr;
@@ -3440,7 +3441,7 @@ function get_next_id_pool($attrib) {
 
   /* Bail out if we had problems getting the next id */
   if (!$tries) {
-    msg_dialog::display(_("Error"), _("Cannot allocate a free ID:")." "._("maximum tries exceeded!"), ERROR_DIALOG);
+    msg_dialog::display(_("Error"), _("Cannot allocate free ID:")." "._("maximum number of tries exceeded!"), ERROR_DIALOG);
   }
 
   return $id;
@@ -3472,10 +3473,10 @@ function get_next_id_traditional($attrib, $dn)
 
   /* get the ranges */
   $tmp = array('0'=> 1000);
-  if (preg_match('/posixAccount/', $oc) && $config->get_cfg_value("uidNumberBase") != ""){
-    $tmp= explode('-',$config->get_cfg_value("uidNumberBase"));
-  } elseif($config->get_cfg_value("gidNumberBase") != ""){
-    $tmp= explode('-',$config->get_cfg_value("gidNumberBase"));
+  if (preg_match('/posixAccount/', $oc) && $config->get_cfg_value("core","uidNumberBase") != ""){
+    $tmp= explode('-',$config->get_cfg_value("core","uidNumberBase"));
+  } elseif($config->get_cfg_value("core","gidNumberBase") != ""){
+    $tmp= explode('-',$config->get_cfg_value("core","gidNumberBase"));
   }
 
   /* Set hwm to max if not set - for backward compatibility */
@@ -3486,7 +3487,7 @@ function get_next_id_traditional($attrib, $dn)
     $hwm= pow(2,32);
   }
   /* Find out next free id near to UID_BASE */
-  if ($config->get_cfg_value("baseIdHook") == ""){
+  if ($config->get_cfg_value("core","baseIdHook") == ""){
     $base= $lwm;
   } else {
     /* Call base hook */
@@ -3500,7 +3501,7 @@ function get_next_id_traditional($attrib, $dn)
 
   /* Should not happen */
   if ($id == $hwm){
-    msg_dialog::display(_("Error"), _("Cannot allocate free ID!"), ERROR_DIALOG);
+    msg_dialog::display(_("Error"), _("Cannot allocate free ID!"), ERROR_DIALOG);
     exit;
   }
 }
@@ -3532,7 +3533,7 @@ function image($path, $action= "", $title= "", $align= "middle")
 
     // Get theme
     if (isset ($config)){
-      $theme= $config->get_cfg_value("theme", "default");
+      $theme= $config->get_cfg_value("core","theme", "default");
     } else {
       # For debuging - avoid that there's no theme set
       die("config not set!");
@@ -3581,55 +3582,28 @@ function image($path, $action= "", $title= "", $align= "middle")
   }
 }
 
-
-function progress($progress, $width= 200, $height= 14)
+/*! \brief    Encodes a complex string to be useable in HTML posts.
+ */
+function postEncode($str)
 {
-  $text= "";
-  $class= "";
-  $style= "width:${width};height:${height}px;";
-
-  // Fix progress range
-  $progress= floor($progress);
-  if ($progress > 100) {
-    $progress= 100;
-  }
-  if ($progress < 0) {
-    $progress= 0;
-  }
-
-  // Only show text if we're above 10px height
-  if ($height>10){
-    $text= $progress."%";
-  }
+  return(preg_replace("/=/","_", base64_encode($str)));
+}
 
-  // Set font size
-  $style.= "font-size:".($height-3)."px;";
+/*! \brief    Decodes a string encoded by postEncode
+ */
+function postDecode($str)
+{
+  return(base64_decode(preg_replace("/_/","=", $str)));
+}
 
-  // Set color
-  if ($progress < 70) {
-    $class= " progress-low";
-  } elseif ($progress < 80) {
-    $class= " progress-mid";
-  } elseif ($progress < 90) {
-    $class= " progress-high";
-  } else {
-    $class= " progress-full";
-  }
-  
-  // Apply gradients
-  $hoffset= floor($height / 2) + 4;
-  $woffset= floor($width * (100-$progress) / 100);
-  $style.="-moz-box-shadow:
-                   0 0 2px rgba(255, 255, 255, 0.4) inset,
-                   0 4px 6px rgba(255, 255, 255, 0.4) inset,
-                   0 ".$hoffset."px 0 -2px rgba(255, 255, 255, 0.2) inset,
-                   -".$woffset."px 0 0 -2px rgba(255, 255, 255, 0.2) inset,
-                   -".($woffset+1)."px 0 0 -2px rgba(0, 0, 0, 0.6) inset,
-                   0pt ".($hoffset+1)."px 8px rgba(0, 0, 0, 0.3) inset,
-                   0pt 1px 0px rgba(0, 0, 0, 0.2);";
 
-  echo "<div class='progress$class' style='$style'>$text</div>";
+/*! \brief    Generate styled output
+ */
+function bold($str)
+{
+  return "<span class='highlight'>$str</span>";
 }
 
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>