From: hickert Date: Tue, 14 Nov 2006 04:35:36 +0000 (+0000) Subject: Ported 2.5 fixes to trunk. (Part 1/x) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2277cb2e30195dddd0dc2e918ff59dd3c6730a2a;p=gosa.git Ported 2.5 fixes to trunk. (Part 1/x) Prepared several user addons for Copy & Paste Fixed Setup problems, ne loop and missing error msgs anymore. Added GraphiMagick fix git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5088 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/setup.php b/html/setup.php index aec16d04d..3320ffd20 100644 --- a/html/setup.php +++ b/html/setup.php @@ -22,14 +22,13 @@ session_start(); $_SESSION['DEBUGLEVEL']= 1; - if (!isset($_GET['js']) && !isset($_SESSION['js'])){ echo ''; $_SESSION['js']= FALSE; -} else { +} elseif(isset($_GET['js'])) { $_SESSION['js']= TRUE; } @@ -56,6 +55,10 @@ if (!file_exists(CONFIG_TEMPLATE_DIR."/gosa.conf")){ // No Errors occured yet $_SESSION['errors']= ""; +$_SESSION['errors'] = ""; +$_SESSION['errorsAlreadyPosted']= array(); +$_SESSION['LastError'] = ""; + // Print out gosa.conf //if(isset($_SESSION['classes'])) print "\$_SESSION['classes']=ok"; @@ -133,13 +136,13 @@ if($next < 1){ // and we call this func again, to output the error // I hope this will work fine ^^ -if((!show_setup_page1(false))||($next == 1)) { +if((show_setup_page1(false))||($next == 1)) { show_setup_page1(); -} elseif((!show_setup_page2(false))||($next==2)) { +} elseif((show_setup_page2(false))||($next==2)) { show_setup_page2(); -} elseif((!show_setup_page3(false))||($next==3)) { +} elseif((show_setup_page3(false))||($next==3)) { show_setup_page3(); -} elseif((!show_setup_page4(false))||($next==4)) { +} elseif((show_setup_page4(false))||($next==4)) { show_setup_page4(); } // This is called to test if we have an administrative Group with a User in it @@ -153,5 +156,3 @@ else { // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> - - diff --git a/ihtml/themes/default/setup.tpl b/ihtml/themes/default/setup.tpl index 09b089408..df4d2be7c 100644 --- a/ihtml/themes/default/setup.tpl +++ b/ihtml/themes/default/setup.tpl @@ -21,15 +21,17 @@ + {include file="$content"} + - +
diff --git a/ihtml/themes/default/setup_introduction.tpl b/ihtml/themes/default/setup_introduction.tpl index abdf49860..451855b52 100644 --- a/ihtml/themes/default/setup_introduction.tpl +++ b/ihtml/themes/default/setup_introduction.tpl @@ -9,7 +9,7 @@

- +

 

diff --git a/ihtml/themes/default/setup_step2.tpl b/ihtml/themes/default/setup_step2.tpl index 6d23e42ef..763b3f1f5 100644 --- a/ihtml/themes/default/setup_step2.tpl +++ b/ihtml/themes/default/setup_step2.tpl @@ -10,5 +10,5 @@

- +

diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index 5336f57c7..78cfb746b 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -139,6 +139,7 @@ class CopyPasteHandler { } }else{ $this->current->save(); + $this->lastdn = $this->current->dn; $this->dialogOpen =false; $this->Clear(); } diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 9f92c624b..72793b3c7 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -915,7 +915,9 @@ class plugin } $todo[] = "is_account"; foreach($todo as $var){ - $this->$var = $source->$var; + if (isset($source->$var)){ + $this->$var= $source->$var; + } } } diff --git a/include/functions_setup.inc b/include/functions_setup.inc index cabcbbdb1..7d5582b06 100644 --- a/include/functions_setup.inc +++ b/include/functions_setup.inc @@ -338,6 +338,7 @@ function get_link($function_name) { $result= "=1.1.2)"), + _("GraphicsMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."), + ($major > 1 || ($major == 1 && $minor >= 1) || ($major == 1 && $minor == 1 && $minor2 >= 2) ) ); + } else { + $msg.= check ( $faults, _("Checking for ImageMagick (>=5.4.0)"), + _("ImageMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."), + ($major > 5 || ($major == 5 && $minor >= 4))); + } } else { $msg.= check ( $faults, _("Checking imagick module for PHP"), _("Imagick is used to convert user supplied images to fit the suggested size and the unified JPEG format from PHP script."), function_exists('imagick_blob2image'), TRUE); @@ -622,11 +630,14 @@ function parse_contrib_conf() /* Show setup_page 1 */ function show_setup_page1($withoutput = true) { - $faults = array(); + $faults = false; + $faults2 = false; $smarty = get_smarty(); $smarty->assign ("content", get_template_path('setup_introduction.tpl')); $smarty->assign ("tests", perform_php_checks($faults)); - $smarty->assign ("detailed_tests", perform_additional_function_checks($faults)); + $smarty->assign ("detailed_tests", perform_additional_function_checks($faults2)); + + $faults = $faults || $faults2; /* This var is true if anything went wrong */ if ($faults){ @@ -646,14 +657,14 @@ function show_setup_page1($withoutput = true) $smarty->display (get_template_path('setup.tpl')); } - return (!$faults); + return ($faults); } /* Show setup_page 2 */ function show_setup_page2($withoutput = true) { - $faults = array(); + $faults = false; $smarty = get_smarty(); $smarty->assign ("content", get_template_path('setup_step2.tpl')); $smarty->assign ("tests", perform_additional_checks($faults)); @@ -671,7 +682,7 @@ function show_setup_page2($withoutput = true) $smarty->display (get_template_path('setup.tpl')); } - return (!$faults); + return ($faults); } @@ -701,18 +712,7 @@ function show_setup_page3($withoutput = true) /* No error till now */ $fault = false; - /* If we pushed the Button continue */ - if(isset($_POST['continue3'])){ - if(!isset($uri)) { - $fault = true; - - /* Output the Error */ - if($withoutput) { - print_red (_("You've to specify an ldap server before continuing!")); - $smarty->assign ("content", get_template_path('setup_step3.tpl')); - } - } - } elseif (!$ds = @ldap_connect (validate($uri))) { + if (!$ds = @ldap_connect (validate($uri))) { $fault =true; /* Output the Error */ @@ -757,7 +757,7 @@ function show_setup_page3($withoutput = true) $smarty->display (get_template_path('setup.tpl')); } - return (!$fault); + return ($fault); } @@ -765,6 +765,34 @@ function show_setup_page4($withoutput = true) { $smarty= get_smarty(); + /* check POST data */ + if(isset($_POST['check'])) { + + /* Check if all needed vars are submitted */ + foreach($checkvars as $key) { + if($key == "peopleou"){ + continue; + } + if($key == "groupou"){ + continue; + } + + if((isset($_POST[$key]))&&($_POST[$key]!="")) { + $_SESSION['ldapconf'][$key] = $_POST[$key]; + } else { + if($withoutput) { + print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key)); + } + $fault = true; + } + } + } + + /* Transfer base */ + if(isset($_POST['base'])){ + $_SESSION['ldapconf']['base']= $_POST['base']; + } + // ? if(!isset($_SESSION['ldapconf']['base'])){ $_SESSION['ldapconf']['base']= $base; @@ -797,7 +825,7 @@ function show_setup_page4($withoutput = true) /* If there are some empty vars in ldapconnect - these values also represent out default values */ - if(!$ds = @ldap_connect (validate($uri))){ + if(!$ds = @ldap_connect (validate($uri))){ $fault = true; if($withoutput){ print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa.")); @@ -805,22 +833,21 @@ function show_setup_page4($withoutput = true) } elseif(!@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){ $fault = true; if($withoutput){ - print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa.")); + print_red (_("Can't set ldap protocol version 3.")); } } elseif(!$r= @ldap_bind ($ds)){ $fault = true; if($withoutput){ - print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa.")); + print_red (_("Could not bind to the specified LDAP server! Please make sure that it is reachable for GOsa.")); } } else { - $sr= @ldap_search ($ds, NULL, "objectClass=*", array("namingContexts")); + $sr= @ldap_search ($r, NULL, "objectClass=*", array("namingContexts")); $attr= @ldap_get_entries($ds,$sr); if((empty($attr))) { - $base= "dc=example,dc=net"; if($withoutput){ - print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice")); +# print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice")); } } else { @@ -860,34 +887,6 @@ function show_setup_page4($withoutput = true) $_SESSION['ldapconf']['arr_crypts'] = $tmp['md5']; } - /* check POST data */ - if(isset($_POST['check'])) { - - /* Check if all needed vars are submitted */ - foreach($checkvars as $key) { - if($key == "peopleou"){ - continue; - } - if($key == "groupou"){ - continue; - } - - if((isset($_POST[$key]))&&($_POST[$key]!="")) { - $_SESSION['ldapconf'][$key] = $_POST[$key]; - } else { - if($withoutput) { - print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key)); - } - $fault = true; - } - } - } - - /* Transfer base */ - if(isset($_POST['base'])){ - $_SESSION['ldapconf']['base']= $_POST['base']; - } - $smarty->assign("arr_cryptkeys",$_SESSION['ldapconf']['arr_cryptkeys']); $smarty->assign("mail_methods", $_SESSION['ldapconf']['mail_methods']); @@ -895,7 +894,7 @@ function show_setup_page4($withoutput = true) $smarty->assign($key,$val); } - if(isset($_POST['check'])) { + if(isset($_POST['check']) || (isset($_POST['admin'])) && isset($_POST['password'])) { $ldap= new LDAP($_SESSION['ldapconf']['admin'], $_SESSION['ldapconf']['password'], $_SESSION['ldapconf']['uri']); @@ -934,7 +933,8 @@ function show_setup_page4($withoutput = true) if($withoutput){ $smarty->display (get_template_path('setup.tpl')); } - return (!$fault); + + return ($fault); } diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index daa147d92..cd3d5a392 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -51,8 +51,6 @@ class userManagement extends plugin /* Creat dialog object */ $this->DivListUsers = new divListUsers($this->config,$this); - /* LOCK MESSAGE Vars */ - $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/"); } @@ -61,6 +59,9 @@ class userManagement extends plugin /* Call parent execute */ plugin::execute(); + /* LOCK MESSAGE Vars */ + $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/"); + $smarty = get_smarty(); // Smarty instance $s_action = ""; // Contains the action to be taken $s_entry = ""; // The value for s_action @@ -201,7 +202,7 @@ class userManagement extends plugin if (isset($_POST['password_finish'])){ /* For security reasons, check if user is allowed to set password again */ - $dn = $this->usertab->dn; + $dn = $this->dn; $acl = $this->ui->get_permissions($dn, "users/password"); $cacl= $this->ui->get_permissions($dn, "users/user"); @@ -798,6 +799,9 @@ class userManagement extends plugin /* Use the last dn to search for it's ID in the newly generated list. */ $dn= $this->CopyPasteHandler->lastdn; + + /* Get new user list */ + $this->reload(); foreach($this->list as $id => $entry){ if($entry['dn'] == $dn){ $s_entry= $id; diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 53b986073..a407f7936 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -463,8 +463,27 @@ class user extends plugin /* Read out data*/ $timeto = $certificate->getvalidto_date(); $timefrom = $certificate->getvalidfrom_date(); - $str = "
CN".preg_replace("/ /", " ", $certificate->getname())."

". - sprintf(_("Certificate is valid from %s to %s and is currently %s."), "".date('d M Y',$timefrom)."","".date('d M Y',$timeto)."", $certificate->isvalid()?""._("valid")."":""._("invalid").""); + + + /* Additional info if start end time is '0' */ + $add_str_info = ""; + if($timeto == 0 && $timefrom == 0){ + $add_str_info = "
"._("(Some types of certificates are currently not supported and may be displayed as 'invalid'.)").""; + } + + $str = " + + + + +
CN".preg_replace("/ /", " ", $certificate->getname())."

". + + sprintf(_("Certificate is valid from %s to %s and is currently %s."), + "".date('d M Y',$timefrom)."", + "".date('d M Y',$timeto)."", + $certificate->isvalid()?""._("valid")."": + ""._("invalid")."").$add_str_info; + $smarty->assign($cert."info",$str); $smarty->assign($cert."_state","true"); } else { @@ -1272,6 +1291,23 @@ class user extends plugin } + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Reset certificate information addepted from source user + to avoid setting the same user certificate for the destination user. */ + $this->userPKCS12= ""; + $this->userSMIMECertificate= ""; + $this->userCertificate= ""; + $this->certificateSerialNumber= ""; + $this->old_certificateSerialNumber= ""; + $this->old_userPKCS12= ""; + $this->old_userSMIMECertificate= ""; + $this->old_userCertificate= ""; + } + + function plInfo() { diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 3ec98eea5..327f90690 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -990,6 +990,15 @@ class mailAccount extends plugin } } + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Reset alternate mail addresses */ + $this->gosaMailAlternateAddress = array(); + } + function plInfo() { diff --git a/plugins/personal/mail/mail_locals.tpl b/plugins/personal/mail/mail_locals.tpl index 3af89089d..d277ceb45 100644 --- a/plugins/personal/mail/mail_locals.tpl +++ b/plugins/personal/mail/mail_locals.tpl @@ -1,40 +1,74 @@ - - - - + + + +
-
-

- {$hint}
-

-
-
-

- -

-
-
-
-

[F] - {t}Filters{/t}

-
-
- - {$alphabet} -
-
-
-
- -
{t}Display
- {$apply} -
-
+
+

+ + + {$hint} + +
+

+
+
+

+ +

+
+
+
+

+ [F] + {t}Filters{/t} +

+
+
+ + {$alphabet} +
+ + + + +
+ +   + +
+ + + + + + +
+ + + +
+ + + + + + +
+ {t}Display addresses of user{/t} + + +
+ {$apply} +
+

@@ -42,3 +76,6 @@  

+ diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc index 9478ccb42..f17f5b36b 100644 --- a/plugins/personal/netatalk/class_netatalk.inc +++ b/plugins/personal/netatalk/class_netatalk.inc @@ -55,6 +55,10 @@ class netatalk extends plugin { var $shares_loaded= false; /* Attributes to save to LDAP */ + var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory"); + var $CopyPasteVars= array("apple_user_homeurl", "apple_user_homeDirectory","apple_user_share","shares_settings","apple_user_homepath_raw", + "apple_user_homeurl_raw","apple_user_homeurl_xml","apple_user_homeurl","selectedshare","mountDirectory"); + /* Slip setting those attributes, we can't define class variables with - */ var $use_save_attributes = array ("apple-user-homeurl", "apple-user-homeDirectory"); @@ -71,6 +75,40 @@ class netatalk extends plugin { var $is_chk_box = array (); var $uid = ""; + + /* The constructor just saves a copy of the config. You may add what ever you need. */ + function netatalk($config, $dn = NULL,$parent = NULL) { + + /* Include config object */ + $this->config = $config; + plugin :: plugin($config, $dn,$parent); + + /* Setting uid to default */ + if(isset($this->attrs['uid'][0])){ + $this->uid = $this->attrs['uid'][0]; + } + + /* Copy needed attributes */ + foreach($this->attributes as $val) { + if (isset($this->attrs["$val"][0])) { + $name = str_replace('-', '_', $val); + $this->$name = $this->attrs["$val"][0]; + } + } + + if (strlen($this->apple_user_homeDirectory) >0) { + $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 ); + } + + /* get share list an set default values */ + $this->get_netatalk_shares(); + $this->apple_user_share = $this->selectedshare; + + /* Save initial account state */ + $this->initially_was_account = $this->is_account; + } + + function get_shares() { $this->shares_loaded= TRUE; @@ -111,33 +149,7 @@ class netatalk extends plugin { asort($this->shares); } - /* The constructor just saves a copy of the config. You may add what ever you need. */ - function netatalk($config, $dn = NULL) { - /* Include config object */ - $this->config = $config; - plugin :: plugin($config, $dn); - - /* Setting uid to default */ - if(isset($this->attrs['uid'][0])){ - $this->uid = $this->attrs['uid'][0]; - } - - /* Copy needed attributes */ - foreach($this->use_save_attributes as $val) { - if (isset($this->attrs["$val"][0])) { - $name = str_replace('-', '_', $val); - $this->$name = $this->attrs["$val"][0]; - } - } - - if (strlen($this->apple_user_homeDirectory) >0) { - $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 ); - } - - /* Save initial account state */ - $this->initially_was_account = $this->is_account; - } /* Execute the plugin, produce the output. */ function execute() { @@ -210,7 +222,7 @@ class netatalk extends plugin { /* Check if we have correct data */ function check() { $message = array (); - + if (strlen($this->apple_user_share) == 0) { $message[] = _("You must select a share to use."); } @@ -247,8 +259,13 @@ class netatalk extends plugin { $ldap = $this->config->get_ldap_link(); - /* Call parents save to prepare $this->attrs */ + /* Reset array of used attributes, because plugin::save() + will not work with '-' in attributes names + after calling save restore attributes array */ + $attributes = $this->attributes; + $this->attributes = array(); plugin :: save(); + $this->attributes = $attributes; /* Do attribute conversion */ foreach ($this->use_save_attributes as $val) { diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 552f59a36..bbbcee0f3 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -67,9 +67,10 @@ class posixAccount extends plugin var $SubSearch = false; /* attribute list for save action */ - var $CopyPasteVars = array("grouplist","groupMembership","use_shadowMin","use_shadowMax", - "use_shadowWarning","use_shadowInactive","use_shadowExpire","mustchangepassword", - "force_ids","printerList","grouplist","savedGidNumber","savedUidNumber","savedGroupMembership"); + var $CopyPasteVars = + array("grouplist","groupMembership","use_shadowMin", + "use_shadowMax","use_shadowWarning","use_shadowInactive","use_shadowExpire", + "must_change_password","printerList","grouplist","savedGidNumber","savedUidNumber"); var $attributes = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos", "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange", @@ -472,8 +473,15 @@ class posixAccount extends plugin } /* Fill calendar */ - $date= getdate($this->shadowExpire); - + /* If this $this->shadowExpire is empty + use current date as base for calculating selectbox values. + (This attribute is empty if this is a new user )*/ + if(empty($this->shadowExpire)){ + $date= getdate(time()); + }else{ + $date= getdate($this->shadowExpire); + } + $days= array(); for($d= 1; $d<32; $d++){ $days[$d]= $d; @@ -853,9 +861,9 @@ class posixAccount extends plugin /* Remove lock needed for unique id generation */ del_lock ("uidnumber"); - - /* Posix accounts have group interrelationship, take care about these here. */ - if ($this->force_ids == 0 && $this->primaryGroup == 0){ + /* Posix accounts have group interrelationship, + take care about these here if this is a new user without forced gidNumber. */ + if ($this->force_ids == 0 && $this->primaryGroup == 0 && !$this->initially_was_account){ $ldap->cd($this->config->current['BASE']); $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn")); @@ -1199,6 +1207,26 @@ class posixAccount extends plugin } + /* Get posts from copy & paste dialog */ + function saveCopyDialog() + { + if(isset($_POST['homeDirectory'])){ + $this->homeDirectory = $_POST['homeDirectory']; + if (isset ($_POST['force_ids'])){ + $data= 1; + $this->gidNumber = $_POST['gidNumber']; + $this->uidNumber = $_POST['uidNumber']; + } else { + $data= 0; + } + if ($this->force_ids != $data){ + $this->is_modified= TRUE; + } + $this->force_ids= $data; + } + } + + /* Create the posix dialog part for copy & paste */ function getCopyDialog() { @@ -1273,6 +1301,16 @@ class posixAccount extends plugin } + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Avoid using the same gid/uid number as source user */ + $this->savedUidNumber = $this->get_next_id("gidNumber"); + $this->savedGidNumber = $this->get_next_id("uidNumber"); + } + + function plInfo() { return (array( diff --git a/plugins/personal/posix/paste_generic.tpl b/plugins/personal/posix/paste_generic.tpl index fbb298152..baf71141a 100644 --- a/plugins/personal/posix/paste_generic.tpl +++ b/plugins/personal/posix/paste_generic.tpl @@ -12,7 +12,7 @@ - +
assign("flagsN", ""); } - /* 'normal' Checkboxes */ - if ($this->pwdCanChange=="1"){ - $smarty->assign("flagsP", "checked"); - } else { - $smarty->assign("flagsP", ""); + if($this->samba3){ + if ($this->sambaPwdCanChange=="1"){ + $smarty->assign("flagsP", "checked"); + } else { + $smarty->assign("flagsP", ""); + } + }else{ + if ($this->pwdCanChange=="1"){ + $smarty->assign("flagsP", "checked"); + } else { + $smarty->assign("flagsP", ""); + } } + if ($this->password_expires=="1"){ $smarty->assign("flagsC", "checked"); } else {