Code

Removed duplicated addslashes
[gosa.git] / plugins / personal / generic / main.inc
index 840bc74236ebeee2fce2880b2aa9a3ce8bca5f59..729d9d5c15e4b348d9e1f87f87770dced9a624db 100644 (file)
@@ -34,6 +34,8 @@ if (!$remove_lock){
   /* Create user object on demand */
   if (!isset($_SESSION['user']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
     $_SESSION['user']= new user ($config, $ui->dn);
+    $_SESSION['user']->set_acl_base($ui->dn);
+    $_SESSION['user']->set_acl_category("users");
   }
   $user= $_SESSION['user'];
 
@@ -43,7 +45,7 @@ if (!$remove_lock){
   }
 
   /* Enter edit mode? */
-  if (isset($_POST['edit'])){
+  if ((isset($_POST['edit'])) && (!isset( $_SESSION['edit']))){
 
     /* Check locking */
     if (($username= get_lock($ui->dn)) != ""){
@@ -137,6 +139,7 @@ if (!$remove_lock){
   }
 
   $info = "";
+
   /* Show page footer depending on the mode */
   if (!$user->cert_dialog && !$user->picture_dialog && $user->is_account){
     $display.= "<p class=\"plugbottom\">";
@@ -146,7 +149,6 @@ if (!$remove_lock){
       $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $display.="<script language='javascript'>";
 
       $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
              "\"> ".$ui->dn."&nbsp;";
@@ -162,11 +164,16 @@ if (!$remove_lock){
         $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
                "\"> ".$ui->dn."&nbsp;";
       }
-      if ($fn == "edit"){
-        $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
-                _("Click the 'Edit' button below to change informations in this dialog");
-        $display.= "<input type=submit name=\"$fn\" value=\"$str\">\n";
+
+      /* Only display edit button if there is at least one attribute editable */
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/user"))){
+        if ($fn == "edit"){
+          $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
+            _("Click the 'Edit' button below to change informations in this dialog");
+          $display.= "<input type=submit name=\"$fn\" value=\"$str\">\n";
+        }
       }
+
       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
     }
     $display.= "</p>\n";