summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 847981d)
raw | patch | inline | side by side (parent: 847981d)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Jan 2008 13:56:50 +0000 (13:56 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Jan 2008 13:56:50 +0000 (13:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8458 594d385d-05f5-0310-b6e9-bd551577e9d8
16 files changed:
diff --git a/gosa-core/plugins/personal/samba/class_sambaAccount.inc b/gosa-core/plugins/personal/samba/class_sambaAccount.inc
+++ /dev/null
@@ -1,1543 +0,0 @@
-<?php
-/*
- This code is part of GOsa (https://gosa.gonicus.de)
- Copyright (C) 2004-2005 Cajus Pollmeier
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class sambaAccount extends plugin
-{
- /* Definitions */
- var $plHeadline= "Samba";
- var $plDescription= "This does something";
- var $view_logged = FALSE;
-
- /* CLI vars */
- var $cli_summary= "Manage users samba account";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* Switch for Samba version */
- var $samba3= FALSE;
- var $uidNumber= 65535;
- var $gidNumber= 65535;
-
- /* Samba 2 attributes */
- var $pwdLastSet= "0";
- var $logonTime= "0";
- var $logoffTime= "2147483647";
- var $kickoffTime= "2147483647";
- var $pwdCanChange= "0";
- var $pwdMustChange= "0";
- var $password_expires= 0;
- var $acctFlags= "[UX ]";
- var $smbHome= "";
- var $homeDrive= "";
- var $scriptPath= "";
- var $profilePath= "";
- var $rid= "";
- var $primaryGroupID= "";
-
- /* Samba 3 attributes */
- var $SID= "";
- var $ridBase= 0;
- var $sambaSID= "";
- var $sambaPwdLastSet= "0";
- var $sambaLogonTime= "0";
- var $sambaLogoffTime= "2147483647";
- var $sambaKickoffTime= "2147483647";
- var $sambaPwdCanChange= "";
- var $sambaPwdMustChange= "0";
- var $sambaAcctFlags= "[UX ]";
- var $sambaHomePath= "";
- var $sambaHomeDrive= "";
- var $sambaLogonScript= "";
- var $sambaProfilePath= "";
- var $sambaPrimaryGroupSID= "";
- var $sambaDomainName= "";
- var $sambaUserWorkstations= "";
- var $sambaBadPasswordCount= "";
- var $sambaBadPasswordTime= "";
- var $sambaPasswordHistory= "";
- var $sambaLogonHours= "";
- var $orig_sambaDomainName= "";
- var $sambaMungedDial= "";
- var $mungedObject;
-
- /* Helper */
- var $show_ws_dialog= FALSE;
- var $logon_time_set= 0;
- var $logoff_time_set= 0;
- var $kickoff_time_set= 0;
-
- /* attribute list for save action */
- var $ctxattributes= array();
- var $attributes= array();
- var $objectclasses= array();
-
- var $uid= "";
- var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName");
-
- var $multiple_support = TRUE;
-
- /* Only used for multiple edit */
- var $temporary_disable = FALSE;
- var $no_password_required = FALSE;
- var $multiple_sambaUserWorkstations = array();
-
- function sambaAccount (&$config, $dn= NULL)
- {
- /* Load attributes depending on the samba version */
- $this->samba3= ($config->current['SAMBAVERSION'] == 3);
-
- if ($this->samba3){
- $this->attributes= array ("sambaSID", "sambaPwdLastSet", "sambaLogonTime",
- "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange",
- "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial",
- "sambaHomePath", "sambaHomeDrive", "sambaLogonScript",
- "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName",
- "sambaUserWorkstations", "sambaPasswordHistory",
- "sambaLogonHours", "sambaBadPasswordTime",
- "sambaBadPasswordCount");
- $this->objectclasses= array ("sambaSamAccount");
- $this->mungedObject= new sambaMungedDial;
- $this->ctxattributes= $this->mungedObject->ctxattributes;
- } else {
- $this->attributes= array ("pwdLastSet", "logonTime", "logoffTime", "kickoffTime",
- "pwdCanChange", "pwdMustChange", "acctFlags", "profilePath", "uid",
- "smbHome", "homeDrive", "scriptPath", "rid", "primaryGroupID");
- $this->objectclasses= array ("sambaAccount");
- }
-
- plugin::plugin ($config, $dn);
-
- /* Setting uid to default */
- if(isset($this->attrs['uid'][0])){
- $this->uid = $this->attrs['uid'][0];
- }
-
- /* Get samba Domain in case of samba 3 */
- if ($this->samba3 && $this->sambaSID != ""){
- $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase","sambaDomainName"));
- if ($ldap->count() != 0){
- $attrs= $ldap->fetch();
- $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
- if ($this->sambaDomainName == ""){
- $this->sambaDomainName= $attrs['sambaDomainName'][0];
- }
- } else {
- if ($this->sambaDomainName == ""){
- $this->sambaDomainName= "DEFAULT";
- }
- $this->ridBase= $this->config->current['RIDBASE'];
- $this->SID= $this->config->current['SID'];
- }
-
- /* Save in order to compare later on */
- $this->orig_sambaDomainName= $this->sambaDomainName;
- }
-
- /* Fill mungedDial field */
- if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
- $this->mungedObject->load($this->sambaMungedDial);
- }
-
- /* Password expiery */
- if(isset($this->attrs['sambaPwdMustChange']) &&
- $this->attrs['sambaPwdMustChange'][0] != 0){
- $this->password_expires= 1;
- }
-
- if(isset($this->attrs['sambaLogonTime']) && ! (
- $this->attrs['sambaLogonTime'][0] == 0 ||
- $this->attrs['sambaLogonTime'][0] == 2147483647
- )){
- $this->logon_time_set= 1;
- }
- if(isset($this->attrs['sambaLogoffTime']) && ! (
- $this->attrs['sambaLogoffTime'][0] == 0 ||
- $this->attrs['sambaLogoffTime'][0] == 2147483647
- )){
- $this->logoff_time_set= 1;
- }
-
- /* Account expiery */
- if(isset($this->attrs['sambaKickoffTime']) && ! (
- $this->attrs['sambaKickoffTime'][0] == 0 ||
- $this->attrs['sambaKickoffTime'][0] == 2147483647
- )){
- $this->kickoff_time_set= 1;
- }
-
- /* Get global filter config */
- if (!session::is_set("sambafilter")){
- $ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
- $sambafilter= array( "depselect" => $base, "regex" => "*");
- session::set("sambafilter", $sambafilter);
- }
-
- /* Save initial account state */
- $this->initially_was_account= $this->is_account;
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- /* Log view */
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","users/".get_class($this),$this->dn);
- }
-
- /* Do we need to flip is_account state? */
- if (isset($_POST['modify_state'])){
- $this->is_account= !$this->is_account;
- }
- /* Do we represent a valid account? */
- if (!$this->is_account && $this->parent === NULL){
- $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\"> <b>".
- _("This account has no samba extensions.")."</b>";
- $display.= back_to_main();
- return ($display);
- }
-
- $display ="";
- if(!$this->multiple_support_active){
-
- /* Show tab dialog headers */
- $display= "";
- if ($this->parent !== NULL){
- if ($this->is_account){
- $display= $this->show_disable_header(_("Remove samba account"),
- _("This account has samba features enabled. You can disable them by clicking below."));
- } else {
- $obj= $this->parent->by_object['posixAccount'];
-
- /* Samba3 dependency on posix accounts are enabled
- in the moment, because I need to rely on unique
- uidNumbers. There'll be a better solution later
- on. */
- if ($obj->is_account){
- $display= $this->show_enable_header(_("Create samba account"),
- _("This account has samba features disabled. You can enable them by clicking below."));
- } else {
- $display= $this->show_enable_header(_("Create samba account"),
- _("This account has samba features disabled. Posix features are needed for samba accounts, enable them first."), TRUE);
- }
- return ($display);
- }
- }
- }
-
- $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
-
- /* Open Samaba Logong hours dialog */
- if(isset($_POST['SetSambaLogonHours']) && $this->samba3 && $this->acl_is_writeable("sambaLogonHours")){
- $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours);
- }
-
- /* Cancel dialog */
- if(isset($_POST['cancel_logonHours'])){
- $this->dialog = FALSE;
- }
-
- /* Save selected logon hours */
- if(isset($_POST['save_logonHours'])){
- $this->dialog->save_object();
- if($this->acl_is_writeable("sambaLogonHours")){
- $this->sambaLogonHours = $this->dialog->save();
- }
- $this->dialog = FALSE;
- }
-
- /* Display dialog */
- if((isset($this->dialog)) && (is_object($this->dialog))){
- $this->dialog->save_object();
- return($this->dialog->execute());
- }
-
- /* Prepare templating */
- $smarty= get_smarty();
-
- $tmp = $this->plInfo();
- foreach($tmp['plProvidedAcls'] as $var => $rest){
- $smarty->assign($var."ACL",$this->getacl($var,$SkipWrite));
- }
-
- if ($this->sambaPwdMustChange=="0"){
- $date= getdate();
- } else {
- $date= getdate($this->sambaPwdMustChange);
- }
-
- if ($this->sambaLogonTime=="2147483647" || $this->sambaLogonTime=="0"){
- $sambaLogonTime_date= getdate();
- } else {
- $sambaLogonTime_date= getdate($this->sambaLogonTime);
- }
-
- if ($this->sambaLogoffTime=="2147483647" || $this->sambaLogoffTime=="0"){
- $sambaLogoffTime_date= getdate();
- } else {
- $sambaLogoffTime_date= getdate($this->sambaLogoffTime);
- }
-
- if ($this->sambaKickoffTime=="2147483647" || $this->sambaKickoffTime=="0"){
- $sambaKickoffTime_date= getdate();
- } else {
- $sambaKickoffTime_date= getdate($this->sambaKickoffTime);
- }
-
- /* Remove user workstations? */
- if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
-
- if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
-
- if($this->multiple_support_active){
- foreach($_POST['workstation_list'] as $name){
- if(isset($this->multiple_sambaUserWorkstations[trim($name)])){
- unset($this->multiple_sambaUserWorkstations[trim($name)]);
- }
- }
- }else{
- $tmp= $this->sambaUserWorkstations;
- foreach($_POST['workstation_list'] as $name){
- $tmp= preg_replace("/$name/", '', $tmp);
- $this->is_modified= TRUE;
- }
- $tmp= preg_replace('/,+/', ',', $tmp);
- $this->sambaUserWorkstations= trim($tmp, ',');
- }
- }
- }
-
- /* Add user workstation? */
- if (isset($_POST["add_ws"])){
- if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
- $this->show_ws_dialog= TRUE;
- $this->dialog= TRUE;
- }
- }
-
- /* Add user workstation finished? */
- if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
- $this->show_ws_dialog= FALSE;
- $this->dialog= FALSE;
- }
-
- /* Add user workstation? */
- if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
-
- if($this->multiple_support_active){
- foreach($_POST['wslist'] as $ws){
- $this->multiple_sambaUserWorkstations[trim($we)] = array("Name" => trim($ws), "UsedByAllUsers" => TRUE);
- }
- }else{
- $tmp= $this->sambaUserWorkstations;
- foreach($_POST['wslist'] as $ws){
- $tmp.= ",$ws";
- }
- $tmp= preg_replace('/,+/', ',', $tmp);
- $this->sambaUserWorkstations= trim($tmp, ',');
- }
- $this->is_modified= TRUE;
- }
-
- /* Show ws dialog */
- if ($this->show_ws_dialog){
-
- /* Save data */
- $sambafilter= session::get("sambafilter");
- foreach( array("depselect", "regex") as $type){
- if (isset($_POST[$type])){
- $sambafilter[$type]= $_POST[$type];
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $sambafilter['regex']= $s;
- }
- session::set("sambafilter", $sambafilter);
-
- /* Get workstation list */
- $exclude= "";
-
- if($this->multiple_support_active){
- foreach($this->multiple_sambaUserWorkstations as $ws){
- if($ws['UsedByAllUsers']){
- $exclude.= "(cn=".$ws['Name']."$)";
- }
- }
- }else{
- foreach(split(',', $this->sambaUserWorkstations) as $ws){
- $exclude.= "(cn=$ws$)";
- }
- }
- if ($exclude != ""){
- $exclude= "(!(|$exclude))";
- }
- $regex= $sambafilter['regex'];
- $filter= "(&(objectClass=sambaSAMAccount)$exclude(uid=*$)(|(uid=$regex)(cn=$regex)))";
- $res= get_list($filter, "winworkstation", $sambafilter['depselect'], array("uid"), GL_SUBSEARCH | GL_SIZELIMIT);
-
- $wslist= array();
- foreach ($res as $attrs){
- $wslist[]= preg_replace('/\$/', '', $attrs['uid'][0]);
- }
- asort($wslist);
-
- $smarty->assign("search_image", get_template_path('images/search.png'));
- $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
- $smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("alphabet", generate_alphabet());
- foreach( array("depselect", "regex") as $type){
- $smarty->assign("$type", $sambafilter[$type]);
- }
- $smarty->assign("hint", print_sizelimit_warning());
- $smarty->assign("wslist", $wslist);
- $smarty->assign("apply", apply_filter());
- $display= $smarty->fetch (get_template_path('samba3_workstations.tpl', TRUE,
- dirname(__FILE__)));
- return ($display);
- }
-
- /* Fill calendar */
- $days= array();
- for($d= 1; $d<32; $d++){
- $days[]= $d;
- }
- $years= array();
- for($y= $date['year']-4; $y<$date['year']+4; $y++){
- $years[]= $y;
- }
- $months= array(_("January"), _("February"), _("March"), _("April"),
- _("May"), _("June"), _("July"), _("August"), _("September"),
- _("October"), _("November"), _("December"));
- $smarty->assign("day", $date["mday"]);
- $smarty->assign("days", $days);
- $smarty->assign("months", $months);
- $smarty->assign("month", $date["mon"]-1);
- $smarty->assign("years", $years);
- $smarty->assign("year", $date["year"]);
-
- $sambaLogonTime_days= array();
- for($d= 1; $d<32; $d++){
- $sambaLogonTime_days[]= $d;
- }
- $sambaLogonTime_years= array();
- for($y= $date['year']-4; $y<$date['year']+4; $y++){
- $sambaLogonTime_years[]= $y;
- }
- $sambaLogonTime_months= array(_("January"), _("February"), _("March"), _("April"),
- _("May"), _("June"), _("July"), _("August"), _("September"),
- _("October"), _("November"), _("December"));
- $smarty->assign("sambaLogonTime_day", $sambaLogonTime_date["mday"]);
- $smarty->assign("sambaLogonTime_days", $sambaLogonTime_days);
- $smarty->assign("sambaLogonTime_months", $sambaLogonTime_months);
- $smarty->assign("sambaLogonTime_month", $sambaLogonTime_date["mon"]-1);
- $smarty->assign("sambaLogonTime_years", $sambaLogonTime_years);
- $smarty->assign("sambaLogonTime_year", $sambaLogonTime_date["year"]);
-
- $sambaLogoffTime_days= array();
- for($d= 1; $d<32; $d++){
- $sambaLogoffTime_days[]= $d;
- }
- $sambaLogoffTime_years= array();
- for($y= $date['year']-4; $y<$date['year']+4; $y++){
- $sambaLogoffTime_years[]= $y;
- }
- $sambaLogoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
- _("May"), _("June"), _("July"), _("August"), _("September"),
- _("October"), _("November"), _("December"));
- $smarty->assign("sambaLogoffTime_day", $sambaLogoffTime_date["mday"]);
- $smarty->assign("sambaLogoffTime_days", $sambaLogoffTime_days);
- $smarty->assign("sambaLogoffTime_months", $sambaLogoffTime_months);
- $smarty->assign("sambaLogoffTime_month", $sambaLogoffTime_date["mon"]-1);
- $smarty->assign("sambaLogoffTime_years", $sambaLogoffTime_years);
- $smarty->assign("sambaLogoffTime_year", $sambaLogoffTime_date["year"]);
-
- $sambaKickoffTime_days= array();
- for($d= 1; $d<32; $d++){
- $sambaKickoffTime_days[]= $d;
- }
- $sambaKickoffTime_years= array();
- for($y= $date['year']-4; $y<$date['year']+4; $y++){
- $sambaKickoffTime_years[]= $y;
- }
- $sambaKickoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
- _("May"), _("June"), _("July"), _("August"), _("September"),
- _("October"), _("November"), _("December"));
- //$smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]-1);
- $smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]); // hickert
- $smarty->assign("sambaKickoffTime_days", $sambaKickoffTime_days);
- $smarty->assign("sambaKickoffTime_months", $sambaKickoffTime_months);
- $smarty->assign("sambaKickoffTime_month", $sambaKickoffTime_date["mon"]-1);
- $smarty->assign("sambaKickoffTime_years", $sambaKickoffTime_years);
- $smarty->assign("sambaKickoffTime_year", $sambaKickoffTime_date["year"]);
-
- /* Fill boxes */
- if ($this->samba3){
- $domains= array();
- foreach($this->config->data['SERVERS']['SAMBA'] as $name => $content){
- $domains[]= $name;
- }
- $smarty->assign("domains", $domains);
- }
- $letters= array();
- for ($i= 68; $i<91; $i++){
- $letters[]= chr($i).":";
- }
- $smarty->assign("drives", $letters);
-
- /* Fill terminal server settings */
- if ($this->samba3){
- foreach ($this->ctxattributes as $attr){
- /* Fill common attributes */
- if (isset($this->mungedObject->ctx[$attr])){
- $smarty->assign("$attr", $this->mungedObject->ctx[$attr]);
- // Set field to blank if value is 0
- if(in_array($attr, array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime"))) {
- if($this->mungedObject->ctx[$attr] == 0) {
- $smarty->assign("$attr", "");
- }
- }
- } else {
- $smarty->assign("$attr", "");
- }
- }
-
- /* Assign enum values for preset items */
- $shadowModeVals= array( "0" => _("disabled"),
- "1" => _("input on, notify on"),
- "2" => _("input on, notify off"),
- "3" => _("input off, notify on"),
- "4" => _("input off, nofify off"));
-
- $brokenConnModeVals= array( "0" => _("disconnect"),
- "1" => _("reset"));
-
- $reConnModeVals= array( "0" => _("from any client"),
- "1" => _("from previous client only"));
-
- /* Fill preset items */
- $smarty->assign("shadow", $shadowModeVals);
- $smarty->assign("brokenconn", $brokenConnModeVals);
- $smarty->assign("reconn", $reConnModeVals);
-
- /* Fill preset items with values */
- $smarty->assign("shadowmode", $this->mungedObject->getShadow());
- $smarty->assign("brokenconnmode", $this->mungedObject->getBrokenConn());
- $smarty->assign("reconnmode", $this->mungedObject->getReConn());
-
- if(session::get('js')){
- /* Set form elements to disabled/enable state */
- $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
-
- $smarty->assign("inheritstate", "");
- if($this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
- $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
- }
- }else{
- $smarty->assign("tsloginstate", "");
- $smarty->assign("inheritstate", "");
- }
-
- /* Set checkboxes to checked or unchecked state */
- $smarty->assign("tslogin", $this->mungedObject->getTsLogin()?"checked":"");
- $smarty->assign("inherit", $this->mungedObject->getInheritMode()?"checked":"");
- $smarty->assign("connectclientdrives",
- $this->mungedObject->getConnectClientDrives()?"checked":"");
- $smarty->assign("connectclientprinters",
- $this->mungedObject->getConnectClientPrinters()?"checked":"");
- $smarty->assign("defaultprinter",
- $this->mungedObject->getDefaultPrinter()?"checked":"");
- $smarty->assign("CtxMaxConnectionTimeF",
- $this->mungedObject->getCtxMaxConnectionTimeF()?"checked":"");
- $smarty->assign("CtxMaxDisconnectionTimeF",
- $this->mungedObject->getCtxMaxDisconnectionTimeF()?"checked":"");
- $smarty->assign("CtxMaxIdleTimeF",
- $this->mungedObject->getCtxMaxIdleTimeF()?"checked":"");
-
-
- /* Fill sambaUserWorkstations */
- $ws= split(",", $this->sambaUserWorkstations);
- sort($ws);
-
- /* Tidy checks for empty option, and smarty will produce one if array[0]="" */
- if(($ws[0]=="")&&(count($ws)==1)) $ws=array();
-
- if($this->multiple_support_active){
- $smarty->assign("multiple_workstations",$this->multiple_sambaUserWorkstations);
- }
-
- $smarty->assign("workstations", $ws);
- }
-
- /* Variables */
- foreach($this->attributes as $val){
- $smarty->assign("$val", $this->$val);
- }
-
- /* 'sambaAcctFlags' checkboxes */
- /* Check for 'lock-account'-flag: 'D' or 'L' */
- if (is_integer(strpos($this->sambaAcctFlags, "D")) ||
- is_integer(strpos($this->sambaAcctFlags, "L"))) {
- $smarty->assign("flagsD", "checked");
- } else {
- $smarty->assign("flagsD", "");
- }
-
- /* Check for no_password_required flag 'N' */
- if (is_integer(strpos($this->sambaAcctFlags, "N"))) {
- $smarty->assign("flagsN", "checked");
- } else {
- $smarty->assign("flagsN", "");
- }
-
- 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 {
- $smarty->assign("flagsC", "");
- }
- if ($this->logon_time_set=="1"){
- $smarty->assign("flagsT", "checked");
- } else {
- $smarty->assign("flagsT", "");
- }
- if ($this->logoff_time_set=="1"){
- $smarty->assign("flagsO", "checked");
- } else {
- $smarty->assign("flagsO", "");
- }
- if ($this->kickoff_time_set=="1"){
- $smarty->assign("flagsK", "checked");
- } else {
- $smarty->assign("flagsK", "");
- }
-
-
- /* In case of javascript, disable some fields on demand */
- if ($this->samba3){
- foreach($this->mungedObject->getOnDemandFlags() as $key => $value) {
- $smarty->assign("$key", "$value");
- }
- }
-
-
- foreach($this->attributes as $attr){
- if(in_array($attr,$this->multi_boxes)){
- $smarty->assign("use_".$attr,TRUE);
- }else{
- $smarty->assign("use_".$attr,FALSE);
- }
- }
- foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath",
- "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
- "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
- "onnectclientprinters","defaultprinter","shadow","brokenconn",
- "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
- "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
- "workstation_list") as $attr){
- if(in_array($attr,$this->multi_boxes)){
- $smarty->assign("use_".$attr,TRUE);
- }else{
- $smarty->assign("use_".$attr,FALSE);
- }
- }
-
- if($this->multiple_support_active){
- $smarty->assign("tsloginstate","");
- }
-
- /* Show main page */
- $smarty->assign("multiple_support",$this->multiple_support_active);
- if ($this->samba3){
- $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__)));
- } else {
- $display.= $smarty->fetch (get_template_path('samba2.tpl', TRUE, dirname(__FILE__)));
- }
-
- return ($display);
- }
-
- function remove_from_parent()
- {
- /* Cancel if there's nothing to do here */
- if (!$this->initially_was_account){
- return;
- }
-
- /* include global link_info */
- $ldap= $this->config->get_ldap_link();
-
- plugin::remove_from_parent();
-
- /* Keep uid attribute for gosaAccount */
- unset($this->attrs['uid']);
- unset($this->attrs['uidNumber']);
- unset($this->attrs['gidNumber']);
-
- /* Remove objectClass for sambaIdmapEntry */
- $tmp= array();
- for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
- if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
- $tmp[]= $this->attrs['objectClass'][$i];
- }
- }
- $this->attrs['objectClass']= $tmp;
-
- @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
- $this->attributes, "Save");
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
- show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/samba account with dn '%s' failed."),$this->dn));
-
- /* Optionally execute a command after we're done */
- $this->handle_post_events("remove", array("uid" => $this->uid));
- }
-
-
- /* Check for input problems */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
-
- if ($this->samba3){
-
- /* Strings */
- foreach (array( "sambaHomePath" => _("Home directory"),
- "sambaProfilePath" => _("Profile path")) as $key => $val){
- if (!$this->mungedObject->is_samba_path($this->$key)){
- $message[]= sprintf(_("The value specified as '%s' contains invalid characters!"), $val);
- }
- }
-
- /* Numeric values */
- foreach (array( "CtxMaxConnectionTime" => _("Connection"),
- "CtxMaxDisconnectionTime" => _("Disconnection"),
- "CtxMaxIdleTime" => _("IDLE")) as $key => $val){
-
- if (isset($this->mungedObject->ctx[$key]) && !tests::is_id($this->mungedObject->ctx[$key]) && $val != 0){
- $message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
- }
- }
-
- /* Too many workstations? Windows usrmgr only supports eight */
- if (substr_count($this->sambaUserWorkstations, ",") >= 8){
- $message[]= _("The windows user manager only allows eight clients. You've specified more than eight.");
- }
- }
-
- return ($message);
- }
-
-
- /* Save data to object */
- function save_object()
- {
-
- $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
-
- /* We only care if we are on the sambaTab... */
- if (isset($_POST['sambaTab'])){
- plugin::save_object();
-
- /* Take care about access options */
- if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
- if ($this->samba3){
- $attrname= "sambaPwdCanChange";
- } else {
- $attrname= "pwdCanChange";
- }
- if (isset($_POST["allow_pwchange"]) && $_POST["allow_pwchange"] == 1){
- $tmp= 1;
- } else {
- $tmp= 0;
- }
- if ($this->$attrname != $tmp){
- $this->is_modified= TRUE;
- }
- $this->pwdCanChange= $tmp;
- $this->sambaPwdCanChange= $tmp;
- }
- $tmp= "UX";
- $this->no_password_required = FALSE;
- if (isset($_POST["no_password_required"])){
- if ($_POST["no_password_required"] == 1){
- $tmp.= "N";
- $this->no_password_required = TRUE;
- }
- }
- if (isset($_POST["password_expires"])){
- if ($_POST["password_expires"] == 1){
- $this->password_expires= 1;
- }
- } else {
- $this->password_expires= 0;
- }
- $this->temporary_disable = FALSE;
- if (isset($_POST["temporary_disable"])){
- if ($_POST["temporary_disable"] == 1){
- $this->temporary_disable = TRUE;
- if (is_integer(strpos($this->sambaAcctFlags, "L"))) {
- $tmp.= "L";
- } else {
- $tmp.= "D";
- }
- }
- }
- if (isset($_POST["logon_time_set"])){
- if ($_POST["logon_time_set"] == 1){
- $this->logon_time_set= 1;
- }
- } else {
- $this->logon_time_set= 0;
- }
- if (isset($_POST["logoff_time_set"])){
- if ($_POST["logoff_time_set"] == 1){
- $this->logoff_time_set= 1;
- }
- } else {
- $this->logoff_time_set= 0;
- }
- if (isset($_POST["kickoff_time_set"])){
- if ($_POST["kickoff_time_set"] == 1){
- $this->kickoff_time_set= 1;
- }
- } else {
- $this->kickoff_time_set= 0;
- }
-
- $fill= "";
- for ($i= strlen($tmp); $i<12; $i++){
- $fill.= " ";
- }
-
- $tmp= "[$tmp$fill]";
-
- /* Only save if acl's are set */
- if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
- if ($this->samba3){
- $attrname= "sambaAcctFlags";
- } else {
- $attrname= "acctFlags";
- }
- if ($this->$attrname != $tmp){
- $this->is_modified= TRUE;
- }
- $this->$attrname= $tmp;
- }
-
- /* Save sambaDomain attribute */
- if ($this->acl_is_writeable("sambaDomainName",$SkipWrite) && $this->samba3 && isset ($_POST['sambaDomainName'],$SkipWrite)){
- $this->sambaDomainName= validate($_POST['sambaDomainName']);
- }
-
- /* Save CTX values */
- if ($this->samba3){
-
- /* Save obvious values */
- foreach($this->ctxattributes as $val){
- if (isset($_POST[$val]) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
- if (get_magic_quotes_gpc()) {
- $this->mungedObject->ctx[$val]= stripcslashes(validate($_POST[$val]));
- } else {
- $this->mungedObject->ctx[$val]= validate($_POST[$val]);
- }
- }
- }
-
- /* Save checkbox states. */
- $this->mungedObject->setTsLogin(!isset($_POST['tslogin'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- // Need to do some index checking to avoid messages like "index ... not found"
- if(isset($_POST['brokenconn'])) {
- $this->mungedObject->setBrokenConn($_POST['brokenconn'] == '1'
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- }
- if(isset($_POST['reconn'])) {
- $this->mungedObject->setReConn($_POST['reconn'] == '1'
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- }
- $this->mungedObject->setInheritMode(isset($_POST['inherit'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- $this->mungedObject->setCtxMaxConnectionTimeF(!isset($_POST['CtxMaxConnectionTimeF'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- $this->mungedObject->setCtxMaxDisconnectionTimeF(
- !isset($_POST['CtxMaxDisconnectionTimeF'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- $this->mungedObject->setCtxMaxIdleTimeF(!isset($_POST['CtxMaxIdleTimeF'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- $this->mungedObject->setConnectClientDrives(isset($_POST['connectclientdrives'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- $this->mungedObject->setConnectClientPrinters(isset($_POST['connectclientprinters'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
- $this->mungedObject->setDefaultPrinter(isset($_POST['defaultprinter'])
- && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-
- /* Save combo boxes. Takes two values */
- if(isset($_POST['reconn'])) {
- $this->mungedObject->setShadow(isset($_POST['shadow']) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite),$_POST['shadow']);
- }
-
- /* Check for changes */
- if ($this->sambaMungedDial != $this->mungedObject->getMunged()){
- $this->is_modified= TRUE;
- }
- }
- }
- }
-
-
- /* Save to LDAP */
- function save()
- {
- /* Load uid and gid of this 'dn' */
- $ldap= $this->config->get_ldap_link();
- $ldap->cat($this->dn, array('uidNumber', 'gidNumber'));
- $tmp= $ldap->fetch();
- $this->uidNumber= $tmp['uidNumber'][0];
- $this->gidNumber= $tmp['gidNumber'][0];
-
- plugin::save();
-
- /* Remove objectClass for sambaIdmapEntry */
- $tmp= array();
- for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
- if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
- $tmp[]= $this->attrs['objectClass'][$i];
- }
- }
- $this->attrs['objectClass']= $tmp;
-
- /* Generate rid / primaryGroupId */
- if ($this->samba3){
- if (!isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){
- msg_dialog::display(_("Warning"), _("Undefined Samba SID detected. Please fix this problem manually!"), WARNING_DIALOG);
- } else {
- $this->SID= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'];
- $this->ridBase= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE'];
- }
-
- /* Need to generate a new uniqe uid/gid combination? */
- if ($this->sambaSID == "" || $this->orig_sambaDomainName != $this->sambaDomainName){
- $uidNumber= $this->uidNumber;
- while(TRUE){
- $sid= $this->SID."-".($uidNumber*2 + $this->ridBase);
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(sambaSID=$sid)", array("sambaSID"));
- if ($ldap->count() == 0){
- break;
- }
- $uidNumber++;
- }
- $this->attrs['sambaSID']= $sid;
-
- /* Check for users primary group */
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
- if ($ldap->count() != 1){
- msg_dialog::display(_("Warning"), _("Cannot convert primary group to samba group: group cannot be identified!"), WARNING_DIALOG);
- } else {
- $attrs= $ldap->fetch();
- $g= new group($this->config, $ldap->getDN());
- if ($g->sambaSID == ""){
- $g->sambaDomainName= $this->sambaDomainName;
- $g->smbgroup= TRUE;
- $g->save ();
- }
- $this->attrs['sambaPrimaryGroupSID']= $g->sambaSID;
- }
- }
-
- if ($this->sambaHomeDrive == ""){
- $this->attrs["sambaHomeDrive"]= array();
- }
-
- /* Generate munged dial value */
- $this->attrs["sambaMungedDial"]= $this->mungedObject->getMunged();
-
- /* User wants me to fake the idMappings? This is useful for
- making winbind resolve the user names in a reasonable amount
- of time in combination with larger databases. */
- if (isset($this->config->current['SAMBAIDMAPPING']) &&
- preg_match('/true/i', $this->config->current['SAMBAIDMAPPING'])){
- $this->attrs['objectClass'][]= "sambaIdmapEntry";
- }
-
-
- /* Password expiery */
- if ($this->password_expires == "1"){
- $this->attrs['sambaPwdMustChange']= $this->sambaPwdMustChange;
- } else {
- $this->attrs['sambaPwdMustChange']= array();
- }
- /* Make sure not to save zero in sambaPwdLastset */
- if ($this->sambaPwdLastSet != "0"){
- $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet;
- } else {
- $this->attrs['sambaPwdLastSet']= array();
- }
- /* Account expiery */
- if ($this->logon_time_set == "1"){
- $this->attrs['sambaLogonTime']= $this->sambaLogonTime;
- } else {
- $this->attrs['sambaLogonTime']= array();
- }
- if ($this->logoff_time_set == "1"){
- $this->attrs['sambaLogoffTime']= $this->sambaLogoffTime;
- } else {
- $this->attrs['sambaLogoffTime']= array();
- }
- if ($this->kickoff_time_set == "1"){
- # Add one day in unixtime format to be compatible with usrmgr
- //$this->attrs['sambaKickoffTime']= $this->sambaKickoffTime + 86400;
- $this->attrs['sambaKickoffTime']= $this->sambaKickoffTime; //hickert
- } else {
- $this->attrs['sambaKickoffTime']= array();
- }
- } else {
- /* Not samba3 */
- $this->attrs['rid']= $this->uidNumber*2 + 1000;
- $this->attrs['primaryGroupID']= $this->gidNumber*2 +1001;
-
- if ($this->homeDrive == ""){
- $this->attrs["homeDrive"]= array();
- }
-
- /* Password expiery */
- if ($this->password_expires == "1"){
- $this->attrs['pwdMustChange']= $this->pwdMustChange;
- } else {
- $this->attrs['pwdMustChange']= 2147483647;
- }
- /* Make sure not to save zero in pwdLastset */
- if ($this->pwdLastSet != "0"){
- $this->attrs['pwdLastSet']= $this->pwdLastSet;
- } else {
- $this->attrs['pwdLastSet']= array();
- }
- /* Account expiery */
- if ($this->logon_time_set == "1"){
- $this->attrs['logonTime']= $this->logonTime;
- } else {
- $this->attrs['logonTime']= array();
- }
- if ($this->logoff_time_set == "1"){
- $this->attrs['logoffTime']= $this->logoffTime;
- } else {
- $this->attrs['logoffTime']= array();
- }
- if ($this->kickoff_time_set == "1"){
- # Add one day in unixtime format to be compatible with usrmgr
- $this->attrs['kickoffTime']= $this->kickoffTime + 86400;
- } else {
- $this->attrs['kickoffTime']= array();
- }
- }
-
- /* Write back to ldap */
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- if($this->initially_was_account){
- new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }else{
- new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }
-
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/samba account with dn '%s' failed."),$this->dn));
-
- /* Optionally execute a command after we're done */
- if ($this->initially_was_account == $this->is_account){
- if ($this->is_modified){
- $this->handle_post_events("modify", array("uid" => $this->uid));
- }
- } else {
- $this->handle_post_events("add", array("uid" => $this->uid));
- }
- }
-
-
- /* Force password set, if this account doesn't have any samba passwords */
- function password_change_needed()
- {
- if(!$this->initially_was_account && $this->is_account){
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("sambaLMPassword","sambaNTPassword"));
- $attrs = $ldap->fetch();
- if(!isset($attrs['sambaLMPassword']) || !isset($attrs['sambaNTPassword'])){
- return(TRUE);
- }
- }
- return(FALSE);
- }
-
-
- function adapt_from_template($dn)
- {
- plugin::adapt_from_template($dn);
- $this->sambaSID= "";
- $this->sambaPrimaryGroupSID= "";
-
- /* Fill mungedDial field */
- if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
- $this->mungedObject->load($this->sambaMungedDial);
- }
-
- /* Password expiery */
- if(isset($this->attrs['sambaPwdMustChange']) &&
- $this->attrs['sambaPwdMustChange'][0] != 0){
- $this->password_expires= 1;
- }
-
- if(isset($this->attrs['sambaLogonTime']) && ! (
- $this->attrs['sambaLogonTime'][0] == 0 ||
- $this->attrs['sambaLogonTime'][0] == 2147483647
- )){
- $this->logon_time_set= 1;
- }
- if(isset($this->attrs['sambaLogoffTime']) && ! (
- $this->attrs['sambaLogoffTime'][0] == 0 ||
- $this->attrs['sambaLogoffTime'][0] == 2147483647
- )){
- $this->logoff_time_set= 1;
- }
-
- /* Account expiery */
- if(isset($this->attrs['sambaKickoffTime']) && ! (
- $this->attrs['sambaKickoffTime'][0] == 0 ||
- $this->attrs['sambaKickoffTime'][0] == 2147483647
- )){
- $this->kickoff_time_set= 1;
- }
-
- /* Get global filter config */
- if (!session::is_set("sambafilter")){
- $ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
- $sambafilter= array( "depselect" => $base, "regex" => "*");
- session::set("sambafilter", $sambafilter);
- }
- }
-
-
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Samba"),
- "plDescription" => _("Samba settings"),
- "plSelfModify" => TRUE,
- "plDepends" => array("user"),
- "plPriority" => 5,
- "plSection" => array("personal" => _("My account")),
- "plCategory" => array("users"),
- "plOptions" => array(),
-
- "plProvidedAcls" => array(
- "AllowLoginOnTerminalServer" => _("Allow login on terminal server"),
- "InheritClientConfig" => _("Inherit client config"),
-
- "sambaPwdCanChange" => _("Allow user to change password") ,
- "sambaAcctFlagsN" => _("Login from windows client requires no password"),
- "sambaAcctFlagsL" => _("Lock samba account"),
-
-
- "sambaKickoffTime" => _("Account expires") ,
- "sambaPwdMustChange" => _("Password expires") ,
-
- "sambaLogonTime" => _("Limit Logon Time") ,
- "sambaLogoffTime" => _("Limit Logoff Time") ,
- "sambaLogonHours" => _("Logon hours") ,
-
- "sambaHomePath" => _("Generic home directory") ,
- "sambaHomeDrive" => _("Generic samba home drive") ,
- "sambaLogonScript" => _("Generic script path") ,
- "sambaProfilePath" => _("Generic profile path") ,
- "sambaDomainName" => _("Domain") ,
- "sambaUserWorkstations" => _("Allow connection from")))
- );
- }
-
- function enable_multiple_support()
- {
- plugin::enable_multiple_support();
- if($this->samba3){
- $this->multiple_support_active = TRUE;
- }else{
- $this->multiple_support_active = FALSE;
- }
- }
-
- function multiple_save_object()
- {
- if (isset($_POST['sambaTab'])){
- $this->save_object();
- plugin::multiple_save_object();
- foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath",
- "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
- "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
- "onnectclientprinters","defaultprinter","shadow","brokenconn",
- "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
- "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
- "workstation_list") as $attr){
- if(isset($_POST["use_".$attr])){
- $this->multi_boxes[] = $attr;
- }
- }
- }
- }
-
-
- function multiple_check()
- {
- $message = plugin::multiple_check();
-
- /* Strings */
- foreach (array( "sambaHomePath" => _("Home directory"),
- "sambaProfilePath" => _("Profile path")) as $key => $val){
- if (in_array($key,$this->multi_boxes) && !$this->mungedObject->is_samba_path($this->$key)){
- $message[]= sprintf(_("The value specified as '%s' contains invalid characters!"), $val);
- }
- }
-
- /* Numeric values */
- foreach (array( "CtxMaxConnectionTime" => _("Connection"),
- "CtxMaxDisconnectionTime" => _("Disconnection"),
- "CtxMaxIdleTime" => _("IDLE")) as $key => $val){
- if (in_array($key,$this->multi_boxes) &&
- isset($this->mungedObject->ctx[$key]) &&
- !tests::is_id($this->mungedObject->ctx[$key]) && $val != 0){
- $message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
- }
- }
-
- /* Too many workstations? Windows usrmgr only supports eight */
- if (substr_count($this->sambaUserWorkstations, ",") >= 8){
- $message[]= _("The windows user manager only allows eight clients. You've specified more than eight.");
- }
- return($message);
- }
-
-
- function get_multi_init_values()
- {
- $ret = plugin::get_multi_init_values();
-
- /* Parse given sambaUserWorkstations into array
- * to allow "init_multiple_support()" to detect multiple used workstations.
- * Those workstations will be displayed in light grey.
- */
- $tmp2 = array("count" => 0);
- $tmp = split(",", $this->sambaUserWorkstations);
- foreach($tmp as $station){
- $station = trim($station);
- if(!empty($station)){
- $tmp2[] = $station;
- $tmp2['count'] ++;
- }
- }
- $ret['sambaUserWorkstations'] = $tmp2;
- return($ret);
- }
-
-
-
- function init_multiple_support($attrs,$all)
- {
- plugin::init_multiple_support($attrs,$all);
-
- $this->multiple_sambaUserWorkstations = array();
- if(isset($all['sambaUserWorkstations'])){
- for($i = 0 ; $i < $all['sambaUserWorkstations']['count'] ; $i++){
- $station = trim($all['sambaUserWorkstations'][$i]);
- $this->multiple_sambaUserWorkstations[$station] = array("Name" => $station, "UsedByAllUsers" => FALSE);
- }
- }
- if(isset($attrs['sambaUserWorkstations'])){
- for($i = 0 ; $i < $attrs['sambaUserWorkstations']['count'] ; $i++){
- $station = trim($attrs['sambaUserWorkstations'][$i]);
- $this->multiple_sambaUserWorkstations[$station] = array("Name" => $station, "UsedByAllUsers" => TRUE);
- }
- }
- }
-
- function multiple_execute()
- {
- return($this->execute());
- }
-
- function get_multi_edit_values()
- {
- $ret = plugin::get_multi_edit_values();
-
- /* Terminal Server */
- if(in_array("tslogin",$this->multi_boxes)){
- $ret['tslogin'] = $this->mungedObject->getTsLogin();
- }
- if(in_array("CtxWFHomeDirDrive",$this->multi_boxes)){
- $ret['CtxWFHomeDirDrive'] = $this->mungedObject->ctx['CtxWFHomeDirDrive'];
- }
- if(in_array("CtxWFHomeDir",$this->multi_boxes)){
- $ret['CtxWFHomeDir'] = $this->mungedObject->ctx['CtxWFHomeDir'];
- }
- if(in_array("CtxWFProfilePath",$this->multi_boxes)){
- $ret['CtxWFProfilePath'] = $this->mungedObject->ctx['CtxWFProfilePath'];
- }
-
- if(in_array("inherit",$this->multi_boxes)){
- $ret['inherit'] = $this->mungedObject->getInheritMode();
- }
- if(in_array("CtxInitialProgram",$this->multi_boxes)){
- $ret['CtxInitialProgram'] = $this->mungedObject->ctx['CtxInitialProgram'];
- }
- if(in_array("CtxWorkDirectory",$this->multi_boxes)){
- $ret['CtxWorkDirectory'] = $this->mungedObject->ctx['CtxWorkDirectory'];
- }
-
- /* Time Limits. Be careful here, there are some negations */
- if(in_array("CtxMaxConnectionTimeF",$this->multi_boxes)){
- $ret["CtxMaxConnectionTimeF"] = !$this->mungedObject->getCtxMaxConnectionTimeF();
- if(!$ret["CtxMaxConnectionTimeF"]){
- $ret["CtxMaxConnectionTime"] = $this->mungedObject->ctx['CtxMaxConnectionTime'];
- }
- }
- if(in_array("CtxMaxDisconnectionTimeF",$this->multi_boxes)){
- $ret["CtxMaxDisconnectionTimeF"]= !$this->mungedObject->getCtxMaxDisconnectionTimeF();
- if(!$ret["CtxMaxDisconnectionTimeF"]){
- $ret["CtxMaxDisconnectionTime"]= $this->mungedObject->ctx['CtxMaxDisconnectionTime'];
- }
- }
- if(in_array("CtxMaxIdleTimeF",$this->multi_boxes)){
- $ret["CtxMaxIdleTimeF"] = !$this->mungedObject->getCtxMaxIdleTimeF();
- if(!$ret["CtxMaxIdleTimeF"]){
- $ret["CtxMaxIdleTime"] = $this->mungedObject->ctx['CtxMaxIdleTime'];
- }
- }
-
- /* Client Devices */
- if(in_array("connectclientdrives",$this->multi_boxes)){
- $ret["connectclientdrives"] = $this->mungedObject->getConnectClientDrives();
- }
- if(in_array("connectclientprinters",$this->multi_boxes)){
- $ret["connectclientprinters"] = $this->mungedObject->getConnectClientPrinters();
- }
- if(in_array("defaultprinter",$this->multi_boxes)){
- $ret["defaultprinter"] = $this->mungedObject->getDefaultPrinter();
- }
-
- /* Misc */
- if(in_array("shadow",$this->multi_boxes)){
- $ret["shadow"] =$this->mungedObject->getShadow();
- }
- if(in_array("brokenconn",$this->multi_boxes)){
- $ret["brokenconn"]=$this->mungedObject->getBrokenConn();
- }
- if(in_array("reconn",$this->multi_boxes)){
- $ret["reconn"] =$this->mungedObject->getReConn();
- }
-
- /* Flags */
- if(in_array("allow_pwchange",$this->multi_boxes)){
- $ret['sambaPwdCanChange'] = $this->sambaPwdCanChange;
- $ret['pwdCanChange'] = $this->pwdCanChange;
- }
-
- if(in_array("password_expires",$this->multi_boxes)){
- $ret['password_expires'] = $this->password_expires;
- $ret['sambaPwdMustChange']= $this->sambaPwdMustChange;
- }
- if(in_array("logon_time_set",$this->multi_boxes)){
- $ret['logon_time_set'] = $this->logon_time_set;
- $ret['sambaLogonTime'] = $this->sambaLogonTime;
- }
- if(in_array("logoff_time_set",$this->multi_boxes)){
- $ret['logoff_time_set'] = $this->logoff_time_set;
- $ret['sambaLogoffTime'] = $this->sambaLogoffTime;
- }
- if(in_array("kickoff_time_set",$this->multi_boxes)){
- $ret['kickoff_time_set'] = $this->kickoff_time_set;
- $ret['sambaKickoffTime'] = $this->sambaKickoffTime;
- }
-
- if(in_array("no_password_required",$this->multi_boxes)){
- $ret['no_password_required'] = $this->no_password_required;
- }
-
- if(in_array("temporary_disable",$this->multi_boxes)){
- $ret['temporary_disable'] = $this->temporary_disable;
- }
-
- if(in_array("SetSambaLogonHours",$this->multi_boxes)){
- $ret['sambaLogonHours'] = $this->sambaLogonHours;
- }
-
- if(in_array("workstation_list",$this->multi_boxes)){
- $ret['multiple_sambaUserWorkstations'] = $this->multiple_sambaUserWorkstations;
- }
- return($ret);
- }
-
- function set_multi_edit_values($values)
- {
- plugin::set_multi_edit_values($values);
-
- /* Prepare current workstation settings to be merged
- * with multiple edit settings.
- */
- if(isset($values['multiple_sambaUserWorkstations'])){
- $cur_ws = array();
- $m_ws = $values['multiple_sambaUserWorkstations'];
-
- /* Prepare current settings to be merged */
- if(isset($this->sambaUserWorkstations)){
- $ttmp = split(",",$this->sambaUserWorkstations);
- foreach($ttmp as $station){
- $station = trim($station);
- if(!empty($station)){
- $cur_ws[$station] = array("Name" => $station, "UsedByAllUsers" => TRUE);
- }
- }
- }
-
- /* Unset removed workstations */
- foreach($cur_ws as $cur_name => $cur_station){
- if(!isset($m_ws[$cur_name])){
- unset($cur_ws[$cur_name]);
- }
- }
-
- /* Add all added workstations */
- foreach($m_ws as $name => $station){
- if($station['UsedByAllUsers']){
- $cur_ws[$name] = $station;
- }
- }
-
- $this->sambaUserWorkstations = "";
- foreach($cur_ws as $name => $ws){
- $this->sambaUserWorkstations .= $name.",";
- }
- $this->sambaUserWorkstations=preg_replace("/,$/","",$this->sambaUserWorkstations);
- }
-
- /* Enable disabled terminal login, this is inverted somehow */
- if(isset($values['tslogin'])) $this->mungedObject->setTsLogin(!$values['tslogin']);
-
- /* Imherit client configuration */
- if(isset($values['inherit'])) $this->mungedObject->setInheritMode($values['inherit']);
-
- /* Get all ctx values posted */
- $ctx = array("CtxWFHomeDirDrive","CtxWFHomeDir","CtxWFProfilePath","CtxInitialProgram","CtxWorkDirectory",
- "CtxMaxConnectionTime","CtxMaxDisconnectionTime","CtxMaxIdleTime");
- foreach($ctx as $attr){
- if(isset($values[$attr])){
- $this->mungedObject->ctx[$attr] = $values[$attr] ;
- }
- }
-
- if(isset($values['CtxMaxConnectionTimeF'])) $this->mungedObject->setCtxMaxConnectionTimeF($values['CtxMaxConnectionTimeF']);
- if(isset($values['CtxMaxDisconnectionTimeF']))$this->mungedObject->setCtxMaxDisconnectionTimeF($values['CtxMaxDisconnectionTimeF']);
- if(isset($values['CtxMaxIdleTimeF'])) $this->mungedObject->setCtxMaxIdleTimeF($values['CtxMaxIdleTimeF']);
-
- if(isset($values['connectclientdrives'])) $this->mungedObject->setConnectClientDrives($values['connectclientdrives']);
- if(isset($values['connectclientprinters'])) $this->mungedObject->setConnectClientPrinters($values['connectclientprinters']);
- if(isset($values['defaultprinter'])) $this->mungedObject->setDefaultPrinter($values['defaultprinter']);
-
- if(isset($values['shadow'])) $this->mungedObject->setShadow($values['shadow'],$values['shadow']);
- if(isset($values['brokenconn'])) $this->mungedObject->setBrokenConn($values['brokenconn'],$values['brokenconn']);
- if(isset($values['reconn'])) $this->mungedObject->setReConn($values['reconn'],$values['reconn']);
-
-
- if(isset($values['sambaPwdCanChange'])) $this->sambaPwdCanChange = $values['sambaPwdCanChange'];
- if(isset($values['pwdCanChange'])) $this->pwdCanChange = $values['pwdCanChange'];
-
-
-
-
- if(isset($values['password_expires'])){
- $this->password_expires = $values['password_expires'];
- $this->sambaPwdMustChange = $values['sambaPwdMustChange'];
- }
- if(isset($values['logon_time_set'])){
- $this->logon_time_set = $values['logon_time_set'];
- $this->sambaLogonTime = $values['sambaLogonTime'];
- }
- if(isset($values['logoff_time_set'])){
- $this->logoff_time_set = $values['logoff_time_set'];
- $this->sambaLogoffTime = $values['sambaLogoffTime'];
- }
- if(isset($values['kickoff_time_set'])){
- $this->kickoff_time_set = $values['kickoff_time_set'];
- $this->sambaKickoffTime = $values['sambaKickoffTime'];
- }
-
- if(isset($values['no_password_required'])){
- if($values['no_password_required']){
- if(!preg_match("/N/",$this->sambaAcctFlags)) {
- $this->sambaAcctFlags = preg_replace("/ /","N",$this->sambaAcctFlags,1);
- }
- }else{
- $this->sambaAcctFlags = preg_replace("/N/"," ",$this->sambaAcctFlags,1);
- }
- }
-
- if(isset($values['temporary_disable'])){
- if($values['temporary_disable']){
- if(preg_match("/L/",$this->sambaAcctFlags)) {
- // Keep L
- }else{
- $this->sambaAcctFlags = preg_replace("/ /","D",$this->sambaAcctFlags,1);
- }
- }else{
- $this->sambaAcctFlags = preg_replace("/D/"," ",$this->sambaAcctFlags,1);
- }
- }
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/samba/class_sambaLogonHours.inc b/gosa-core/plugins/personal/samba/class_sambaLogonHours.inc
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-
-class sambaLogonHours extends plugin
-{
-
- var $sambaLogonHours = "";
- var $Matrix = array();
- var $timezone = 0;
- var $config;
-
- function sambaLogonHours (&$config, $dn, $slh)
- {
- plugin::plugin($config,$dn);
- $this->sambaLogonHours = $slh;
-
- /* Get default timezone */
- $zone = timezone::get_default_timezone();
- $this->timezone = $zone['value'];
-
- /* Convert to bin */
- $tmp = '';
- for($i = 0 ; $i < strlen($slh) ; $i ++){
- $tmp .= str_pad(base_convert($slh[$i],16,2),4,'0',STR_PAD_LEFT);
- }
- $slh = $tmp;
-
- /* Set to default if value is empty or seams to be broken */
- if(strlen($slh) != 168){
- $slh = str_pad('',168 , "1");
- }
-
- /* Rework string, because it was stored in little endian */
- $new = '';
- for($i = 0 ; $i < 21 ; $i ++ ){
- $part = strrev(substr($slh, $i * 8, 8));
- $byte['hi'] = substr($part,0,4);
- $byte['low'] = substr($part,4,4);
- $new .= $byte['hi'].$byte['low'];
- }
-
- /* Shift string to match given timezone settings */
- $shift_by = (168 + $this->timezone) % 168;
- for($i = 0 ; $i < $shift_by; $i ++){
- $new = $new[167].$new;
- $new = substr($new,0,168);
- }
-
- /* Create matrix */
- $this->Matrix = array();
- for($day = 0 ; $day < 7 ; $day ++ ){
- for($hour = 0 ; $hour < 24 ; $hour ++){
- $bitpos = ($day * 24 + $hour) % 168;
- $this->Matrix[$day][$hour] = $new[$bitpos];
- }
- }
- }
-
- function execute()
- {
-
- $week_days = array();
- $week_days[0]= _("Sunday");
- $week_days[1]= _("Monday");
- $week_days[2]= _("Tuesday");
- $week_days[3]= _("Wednesday");
- $week_days[4]= _("Thursday");
- $week_days[5]= _("Friday");
- $week_days[6]= _("Saturday");
-
- $hours = array();
- for($i = 0 ; $i <24 ; $i++ ){
- $hours[$i] = $i ;
- }
- $ui =get_userinfo();
-
- $smarty = get_smarty();
- $smarty->assign("Matrix",$this->Matrix);
- $smarty->assign("Days" ,$week_days);
- $smarty->assign("Hours" ,$hours);
- return($smarty->fetch(get_template_path("sambaLogonHours.tpl",TRUE,dirname(__FILE__))));
- }
-
- function save_object()
- {
- /* Get userinfo */
- $ui = get_userinfo();
-
- /* Check if dialog was opened and if there were any changes */
- if(isset($_POST['sambaLogonHoursPosted'])){
- foreach($this->Matrix as $day_key => $days){
- foreach($days as $hour_key => $hour){
- if(isset($_POST['day_'.$day_key.'_'.$hour_key])){
- $this->Matrix[$day_key][$hour_key] = 1;
- }else{
- $this->Matrix[$day_key][$hour_key] = 0;
- }
- }
- }
- }
- }
-
- function save()
- {
-
- /* Convert Matrix to Hex */
- $slh = "";
- foreach($this->Matrix as $day_key => $days){
- foreach($days as $hour_key => $hour){
- $slh .= $hour;
- }
- }
-
- /* Shift string to match given timezone settings */
- $shift_by = (168 + ($this->timezone*(-1))) % 168;
- for($i = 0 ; $i < $shift_by; $i ++){
- $slh = $slh[167].$slh;
- $slh = substr($slh,0,168);
- }
-
- /* Rework string, because it was stored in little endian */
- $new = '';
- for($i = 0 ; $i < 21 ; $i ++ ){
- $part = strrev(substr($slh, $i * 8, 8));
- $byte['hi'] = substr($part,0,4);
- $byte['low'] = substr($part,4,4);
- $new .= $byte['hi'].$byte['low'];
- }
-
- /* Convert to bin */
- $tmp = '';
- for($i = 0 ; $i < 21 ; $i ++){
- $tmp .= str_pad(base_convert(substr($new,$i*8,8),2,16),2,'0',STR_PAD_LEFT);
- }
-
- /* Create uppercase HEX chars */
- $ret = strtoupper( $tmp);
-
- /* All hours and days selected */
- if(substr_count($ret,'F') == 42){
- $ret = "";
- }
-
- return($ret);
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/samba/class_sambaMungedDial.inc b/gosa-core/plugins/personal/samba/class_sambaMungedDial.inc
+++ /dev/null
@@ -1,609 +0,0 @@
-<?php
-/*
- This code is part of GOsa (https://gosa.gonicus.de)
- Copyright (C) 2004 Cajus Pollmeier
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-
-/* File header is treated as constant. It cannot be defined inside the class if $PHP_VERSION < 5 */
-define ("FILEHEADER",
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "5000");
-/* This is the old header, it is needed to automatically convert old mungedDials to new ones */
-define ("FILEHEADER_OLD",
- "6d000800200020002000200020002000".
- "20002000200020002000200020002000".
- "20002000200020002000200064000100".
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "20002000200020002000200020002000".
- "50001000");
-
-class sambaMungedDial
-{
- /* Terminal server variables (samba3) */
- var $ctx= array(
- 'CtxCfgPresent' => '551e0bb0',
- 'CtxCfgFlags1' => '00e00010',
- 'CtxCallback' => '',
- 'CtxShadow' => '01000000',
- 'CtxMaxConnectionTime' => '',
- 'CtxMaxDisconnectionTime' => '',
- 'CtxMaxIdleTime' => '',
- 'CtxKeyboardLayout' => '',
- 'CtxMinEncryptionLevel' => '00',
- 'CtxWorkDirectory' => '',
- 'CtxNWLogonServer' => '',
- 'CtxWFHomeDir' => '',
- 'CtxWFHomeDirDrive' => '',
- 'CtxWFProfilePath' => '',
- 'CtxInitialProgram' => '',
- 'CtxCallbackNumber' => '');
-
- /* attribute list for save action */
- var $ctxattributes= array("CtxCfgPresent", "CtxCfgFlags1", "CtxCallback",
- "CtxShadow", "CtxMaxConnectionTime", "CtxMaxDisconnectionTime",
- "CtxMaxIdleTime", "CtxKeyboardLayout", "CtxMinEncryptionLevel",
- "CtxWorkDirectory", "CtxNWLogonServer", "CtxWFHomeDir",
- "CtxWFHomeDirDrive", "CtxWFProfilePath", "CtxInitialProgram",
- "CtxCallbackNumber");
-
- /* These parameters are treated as strings and get a trailing zero */
- var $stringParams= array( "CtxWorkDirectory", "CtxNWLogonServer",
- "CtxWFHomeDir", "CtxWFHomeDirDrive",
- "CtxWFProfilePath", "CtxInitialProgram", "CtxCallbackNumber");
-
- /* These parameters are treated as time values and get converted */
- var $timeParams= array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime");
-
- var $old_behavior= false;
-
- function strhex($string)
- {
- $hex="";
-
- for ($i=0; $i<strlen($string); $i++) {
- $hex.= dechex(ord($string[$i]));
- }
-
- return ($hex);
- }
-
- function hexstr($hex)
- {
- $string="";
-
- for ($i=0; $i<strlen($hex)-1; $i+=2) {
- $string.= chr(hexdec($hex[$i].$hex[$i+1]));
- }
-
- return ($string);
- }
-
- function endian($src)
- {
- return (substr($src, 2, 2).substr($src, 0, 2));
- }
-
- function genTime ($minutes)
- {
- $usec= (int) ($minutes * 60 * 1000);
- $src= sprintf('%04x%04x', $usec & 0x0FFFF, ($usec & 0x0FFFF0000) >> 16);
- return (sambaMungedDial::endian(substr($src, 0, 4)).sambaMungedDial::endian(substr($src, 4, 4)));
- }
-
- function readTime ($time)
- {
- $lo= substr($time, 0, 4);
- $hi= substr($time, 4, 4);
-
- $usecs= (hexdec(substr($lo, 2, 2)) * 256 + hexdec(substr($lo, 0, 2))) +
- (hexdec(substr($hi, 2 ,2)) * 256 + hexdec(substr($hi, 0, 2))) * 256 * 256;
-
- return ((int)($usecs / (60 * 1000)));
- }
-
- function to8bit($string)
- {
- $result= "";
-
- /* Strip zeros */
- for ($i= 0; $i<strlen($string); $i++){
- if ($string[$i] != chr(0)){
- $result.= $string[$i];
- }
- }
-
- return ($result);
- }
-
- function is_samba_path($path)
- {
- if ($path == ""){
- return (TRUE);
- }
-
- if (!preg_match('/^[a-z0-9%\\\\_.:+-\\\\$]+$/i', $path)){
- return (FALSE);
- }
-
- return preg_match ("/\\\\.+$/", $path);
- }
-
- /* Encode full MungedDial-String */
- function encode_munged ($params)
- {
- /* Walk through the parameters and convert them */
- $result= sambaMungedDial::hexstr(FILEHEADER);
-
- // CHANGED: We need to insert the number of attributes right after FILEHEADER.
- $counter= 0;
- $result_tmp= "";
- foreach ($params as $paramName => $paramValue) {
- /* String parameter? */
- if (in_array($paramName, $this->stringParams)){
- $isString= TRUE;
- $paramValue= sambaMungedDial::strhex($paramValue.chr(0).chr(0));
- } else {
- $isString= FALSE;
- }
-
- /* Time parameter? */
- if (in_array($paramName, $this->timeParams)){
- $paramValue= sambaMungedDial::genTime($paramValue);
- }
-
- $result_tmp.= sambaMungedDial::munge($paramName, $paramValue, $isString);
- $counter++;
- }
-
- // First add the number of attributes
- $result.= sambaMungedDial::hexstr(sprintf("%02x00", $counter));
-
- // Then the usual stuff
- $result.= $result_tmp;
-
- return ($result);
- }
-
- /* Setup parameter given by paramName to MungedDial-Format */
- function munge($paramName, $paramValue, $isString)
- {
- $result= "";
-
- /* Encode paramName to UTF-16 */
- if (function_exists("recode")){
- $utfName= recode("ISO8859-15..UTF-16", $paramName);
- } else {
- $utfName= iconv("ISO8859-15", "UTF-16BE", $paramName);
- }
-
- /* Set parameter length, high and low byte */
- $paramLen= strlen($utfName);
- $result.= chr($paramLen & 0x0FF);
- $result.= chr(($paramLen & 0x0FF00) >> 8);
-
- /* String parameters have additional trailing bytes */
- $valueLen= strlen($paramValue);
- $result.= chr($valueLen & 0x0FF);
- $result.= chr(($valueLen & 0x0FF00) >> 8);
-
- /* Length fields have a trailing '01' appended by the UTF-16 converted name */
- $result.= chr(1);
- $result.= $utfName;
-
- /* Parameter is padded with '00' */
- $result.= chr(0);
- $result.= $paramValue;
-
- /* Append a trailing '00' to string parameters */
- if ($isString && (strlen($paramValue) & 1)){
- $result.= chr(0);
- }
-
- return ($result);
- }
-
- /* Takes a base64-encoded MungedDial-String and returns an array of included parameters and values */
- function decode_munged($munge)
- {
- $result= array();
-
- /*
- * Remove base64 encoding and skip FILEHEADER.
- * The '4' is added, because the FILEHEADER has been stripped by 4 chars.
- * This is the number of attributes following - we don't need this at read time, only when writing.
- */
- if(substr(base64_decode($munge),0,2)=="6d") {
- $this->old_behavior=true;
- }
-
- $ctxField="";
- if($this->old_behavior==true) {
- $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER_OLD)) / 2);
- } else {
- $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER)+4) / 2);
- }
-
- /* Decode parameters */
- while ($ctxField!=""){
-
- /* Read value lengths */
- $ctxParmNameLength= ord($ctxField[0]) + 16 * ord($ctxField[1]);
- $ctxParmLength= ord($ctxField[2]) + 16 * ord($ctxField[3]);
-
- /* Reposition ctxField on start of parameter name, read parameter name */
- $ctxField= substr($ctxField, 6);
- $ctxParmName= sambaMungedDial::to8bit(substr($ctxField, 0, $ctxParmNameLength));
-
- /* Reposition ctxField on start of parameter */
- $ctxField= substr($ctxField, $ctxParmNameLength);
- $ctxParm= substr($ctxField, 0, $ctxParmLength);
-
- /* If string parameter, convert */
- if (in_array($ctxParmName, $this->stringParams)){
- $ctxParm= sambaMungedDial::hexstr($ctxParm);
- }
- /* If time parameter, convert */
- if (in_array($ctxParmName, $this->timeParams)){
- $ctxParm= sambaMungedDial::readTime($ctxParm);
- }
-
- /* Assign in result array */
- $result[$ctxParmName]= trim($ctxParm);
-
- /* Reposition ctxField on end of parameter and continue */
- $ctxField= substr($ctxField, $ctxParmLength);
- }
-
- return ($result);
- }
-
- /* function takes a base64-encoded sambaMungedDial */
- function load ($mungedDial)
- {
- $this->ctx= $this->decode_munged($mungedDial);
- }
-
- /* Returns ready-to-run mungedDialString to be filled into ldap */
- function getMunged ()
- {
- // Do extra check for valid timeParams (they must be set to 0 if disabled)
- foreach($this->timeParams as $value) {
- if(!isset($this->ctx[$value])) {
- $this->ctx[$value]= 0;
- }
- }
- $result= base64_encode($this->encode_munged($this->ctx));
-
- return $result;
- }
-
- /* Returns array of flags, which can be set on-demand with activated java-script */
- function getOnDemandFlags ()
- {
- $result= array();
- if (session::get("js")){
- foreach ($this->timeParams as $value) {
- if (!isset($this->ctx[$value]) || (isset($this->ctx[$value]) && $this->ctx[$value] == 0)) {
- $result[$value."Mode"]= "disabled";
- } else {
- $result[$value."Mode"]= "";
- }
- }
-
- if (substr($this->ctx['CtxCfgFlags1'], 6, 1) == "1") {
- $result['CtxInitialProgramMode'] = "disabled";
- } else {
- $result['CtxInitialProgramMode'] = "";
- }
- }else{
- foreach ($this->timeParams as $value) {
- $result[$value."Mode"]= "";
- }
-
- $result['CtxInitialProgramMode'] = "";
-
- }
-
- return $result;
- }
-
- /*Gets Terminal-Server-Login value: enabled/disabled */
- function getTsLogin ()
- {
- $flags= ord(substr($this->ctx['CtxCfgFlags1'], 5, 1));
-
- if ($flags & 1) {
- $result= false;
- } else {
- $result= true;
- }
-
- return $result;
- }
-
- /* Sets Terminal-Server-Login value: enabled/disabled */
- function setTsLogin ($checked)
- {
- $flag= substr($this->ctx['CtxCfgFlags1'], 5, 1);
-
- if ($checked) {
- $flag|= 1;
- } else {
- $flag&= 0xFE;
- }
-
- $this->ctx['CtxCfgFlags1'][5]= sprintf('%1x', $flag);
- }
-
- /* gets Broken-Connection value: disconnect/reset */
- function getBrokenConn ()
- {
- $flags= ord(substr($this->ctx['CtxCfgFlags1'], 5, 1));
- if ($flags & 4) {
- $result= "1";
- } else {
- $result= "0";
- }
-
- return $result;
- }
-
- /* sets Broken-Connection value: disconnect/reset */
- function setBrokenConn ($checked)
- {
- $flag= substr($this->ctx['CtxCfgFlags1'], 5, 1);
-
- if ($checked) {
- $flag|= 4;
- } else {
- $flag&= 0xFB;
- }
-
- $this->ctx['CtxCfgFlags1'][5]= sprintf('%1x', $flag);
- }
-
- /* gets Reconnection value: from any client/from previous client only */
- function getReConn ()
- {
- $flags= ord(substr($this->ctx['CtxCfgFlags1'], 5, 1));
- if ($flags & 2) {
- $result= "1";
- } else {
- $result= "0";
- }
-
- return $result;
- }
-
- /* sets Reconnection value: from any client/from previous client only */
- function setReConn ($checked)
- {
- $flag= substr($this->ctx['CtxCfgFlags1'], 5, 1);
-
- if ($checked) {
- $flag|= 2;
- } else {
- $flag&= 0xFD;
- }
-
- $this->ctx['CtxCfgFlags1'][5]= sprintf('%1x', $flag);
- }
-
- /* gets Inherit-config-from-client value: enabled/disabled */
- function getInheritMode ()
- {
- if (substr($this->ctx['CtxCfgFlags1'], 6, 1) == "1") {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* sets Inherit-config-from-client value: enabled/disabled */
- function setInheritMode ($checked)
- {
- if ($checked) {
- $this->ctx['CtxCfgFlags1'][6]= "1";
- } else {
- $this->ctx['CtxCfgFlags1'][6]= "0";
- }
- }
-
- /* gets shadow value (enum): 0-4
- 0: disabled
- 1: input on, notify on
- 2: input on, notify off
- 3: input off, notify on
- 4: input off, notify off
- */
- function getShadow ()
- {
- if($this->old_behavior==true) {
- $result= substr($this->ctx['CtxCfgFlags1'], 1, 1);
- } else {
- $result= substr($this->ctx['CtxShadow'], 1, 1);
- }
- return $result;
- }
-
- /* sets shadow value */
- function setShadow ($checked, $value)
- {
- if ($checked) {
- if($this->old_behavior==true) {
- // We need to reset the old setting
- $this->ctx['CtxCfgFlags1'][1]= sprintf('%1X', $value);
- }
- $this->ctx['CtxShadow'][1]= sprintf('%1x', $value);
- }
- }
-
- /* gets connect-client-drive-at-logon value: enabled/disabled */
- function getConnectClientDrives ()
- {
- $connections= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
- if ($connections & 8) {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* sets connect-client-drive-at-logon value: enabled/disabled */
- function setConnectClientDrives ($checked)
- {
- $flag= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
- if ($checked) {
- $flag|= 8;
- } else {
- $flag&= 0xF7;
- }
-
- $this->ctx['CtxCfgFlags1'][2]= sprintf('%1x', $flag);
- }
-
- /* gets connect-client-printers-at-logon value: enabled/disabled */
- function getConnectClientPrinters ()
- {
- $connections= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
- if ($connections & 4) {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* sets connect-client-printers-at-logon value: enabled/disabled */
- function setConnectClientPrinters ($checked)
- {
- $flag= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
-
- if ($checked) {
- $flag|= 4;
- } else {
- $flag&= 0xFB;
- }
-
- $this->ctx['CtxCfgFlags1'][2]= sprintf('%1x', $flag);
- }
-
- /* gets set-client-printer-to-default value: enabled/disabled */
- function getDefaultPrinter ()
- {
- $connections= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
- if ($connections & 2) {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* sets set-client-printer-to-default value: enabled/disabled */
- function setDefaultPrinter ($checked)
- {
- $flag= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
-
- if ($checked) {
- $flag|= 2;
- } else {
- $flag&= 0xFD;
- }
-
- $this->ctx['CtxCfgFlags1'][2]= sprintf('%1x', $flag);
- }
-
- /* SMARTY: gets the checkbox state of "Connection" */
- function getCtxMaxConnectionTimeF ()
- {
- // Connection Time is 0 if disabled
- if (isset($this->ctx['CtxMaxConnectionTime']) && ($this->ctx['CtxMaxConnectionTime'] != 0)) {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* SMARTY: sets the checkbox "Connection" to unchecked */
- function setCtxMaxConnectionTimeF ($checked)
- {
- if ($checked) {
- unset ($this->ctx['CtxMaxConnectionTime']);
- }
- }
-
- /* SMARTY: gets the checkbox state of "Disconnection" */
- function getCtxMaxDisconnectionTimeF ()
- {
- // Connection Time is 0 if disabled
- if (isset($this->ctx['CtxMaxDisconnectionTime']) && ($this->ctx['CtxMaxDisconnectionTime'] != 0)) {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* SMARTY: sets the checkbox "Disconnection" to unchecked */
- function setCtxMaxDisconnectionTimeF ($checked)
- {
- if ($checked) {
- unset ($this->ctx['CtxMaxDisconnectionTime']);
- }
- }
-
- /* SMARTY: gets the checkbox state of "Idle" */
- function getCtxMaxIdleTimeF ()
- {
- // Connection Time is 0 if disabled
- if (isset($this->ctx['CtxMaxIdleTime']) && ($this->ctx['CtxMaxIdleTime'] != 0)) {
- $result= true;
- } else {
- $result= false;
- }
-
- return $result;
- }
-
- /* SMARTY: sets the checkbox "Idle" to unchecked */
- function setCtxMaxIdleTimeF ($checked)
- {
- if ($checked) {
- unset ($this->ctx['CtxMaxIdleTime']);
- }
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/samba/main.inc b/gosa-core/plugins/personal/samba/main.inc
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/*
- This code is part of GOsa (https://gosa.gonicus.de)
- Copyright (C) 2003 Cajus Pollmeier
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-$display = "";
-$lock_msg = "";
-if (!$remove_lock){
- /* Reset requested? */
- if (isset($_POST['edit_cancel']) ||
- (isset($_GET['reset']) && $_GET['reset'] == 1)){
-
- del_lock ($ui->dn);
- session::un_set ('edit');
- session::un_set ('sambaAccount');
- }
-
- /* Create sambaAccount object on demand */
- if (!session::is_set('sambaAccount') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
- $sambaAccount= new sambaAccount ($config, $ui->dn);
- $sambaAccount->enable_CSN_check();
- $sambaAccount->set_acl_base($ui->dn);
- $sambaAccount->set_acl_category("users");
- session::set('sambaAccount',$sambaAccount);
- }
- $sambaAccount = session::get('sambaAccount');
-
- /* save changes back to object */
- if (session::is_set('edit')){
- $sambaAccount->save_object ();
- }
-
- /* Enter edit mode? */
- if (isset($_POST['edit'])){
-
- /* Check locking */
- if (($username= get_lock($ui->dn)) != ""){
- session::set('back_plugin',$plug);
- session::set('LOCK_VARS_TO_USE',array("/^edit$/","/^plug$/"));
- $lock_msg = gen_locked_message ($username, $ui->dn);
-
- }else{
-
- /* Lock the current entry */
- add_lock ($ui->dn, $ui->dn);
- session::set('dn',$ui->dn);
- session::set('edit',TRUE);
- }
- }
-
- /* save changes to LDAP and disable edit mode */
- if (isset($_POST['edit_finish'])){
-
- /* Perform checks */
- $message= $sambaAccount->check ();
-
- /* No errors, save object */
- if (count ($message) == 0){
- $sambaAccount->save ();
- del_lock ($ui->dn);
- session::un_set ('edit');
-
- /* Remove from session */
- session::un_set ('sambaAccount');
- } else {
- /* Errors found, show message */
- show_errors ($message);
- }
- }
-
- /* Execute formular */
- if($lock_msg){
- $display.= $lock_msg;
- }else{
- $display.= $sambaAccount->execute ();
- }
-
- /* Store changes in session */
- if (session::is_set('edit')){
- session::set('sambaAccount',$sambaAccount);
- }
-
- $info= "";
- if (($sambaAccount->is_account) && (!$sambaAccount->show_ws_dialog) && empty($lock_msg)){
- $display.= "<p class=\"plugbottom\">";
-
- /* Are we in edit mode? */
- if (session::is_set('edit')){
- $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
- $display.= " ";
- $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
- $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
- "\"> ".$ui->dn." ";
- } else {
- $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
- "\"> ".$ui->dn." ";
-
- if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/sambaAccount"))){
-
- $info.= "<img 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=\"edit\" value=\""._("Edit")."\">\n";
- }
- $display.= "<input type=\"hidden\" name=\"ignore\">\n";
- }
- $display.= "</p>\n";
- }
-
- /* Page header*/
- $display= print_header(get_template_path('images/samba.png'), _("Samba settings"),
- $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/samba/samba2.tpl b/gosa-core/plugins/personal/samba/samba2.tpl
+++ /dev/null
@@ -1,116 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
-
- <!-- Headline container -->
- <tr>
- <td colspan="2" style="width:50%; vertical-align:top;">
- <h2><p class="center"><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</p></h2>
- </td>
- </tr>
- <tr>
- <td style="vertical-align:top;">
- <table summary="">
- <tr>
- <td><label for="smbHome">{t}Samba home{/t}</label></td>
- <td>
-
-{render acl=$smbHomeACL}
- <input id="smbHome" name="smbHome" size=30 maxlength=60 value="{$smbHome}">
-{/render}
-
-{render acl=$smbDriveACL}
- <select size="1" name="homeDrive">
- <option disabled> </option>
- {html_options values=$drives output=$drives selected=$homeDrive}
- </select>
-{/render}
-
- </td>
- </tr>
- </table>
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top;">
- <table summary="">
- <tr>
- <td><label for="scriptPath">{t}Script path{/t}</label></td>
- <td>
-{render acl=$scriptPathACL}
- <input id="scriptPath" name="scriptPath" size=35 maxlength=60 value="{$scriptPath}">
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="profilePath">{t}Profile path{/t}</label></td>
- <td>
-{render acl=$profilePathACL}
- <input id="profilePath" name="profilePath" size=35 maxlength=60 value="{$profilePath}">
-{/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<p class="seperator"> </p>
-
-<h2><p class="center"><img class="center" alt="" align="middle" src="images/certs.png" /> {t}Access options{/t}</p></h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
- <tr>
- <td style="width:50%;">
-{render acl=$allow_pwchangeACL}
- <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP}>
-{/render}
- <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
- <br>
-{render acl=$no_password_requiredACL}
- <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN}>
-{/render}
- <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
- <br>
-{render acl=$temporary_disableACL}
- <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD}>
-{/render}
- <label for="temporary_disable">{t}Temporary disable samba account{/t}</label>
- <br>
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top; width:50%">
-{render acl=$password_expiresACL}
- <input type=checkbox name="password_expires" value="1" {$flagsC}>
-{/render}
- <label for="day">{t}Password expires on{/t}</label>
-{render acl=$sambaPwdMustChangeACL}
- <select id="day" name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
- {html_options values=$days output=$days selected=$day}
- </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
- <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
- {html_options options=$months selected=$month}
- </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
- <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
- {html_options values=$years output=$years selected=$year}
- </select>
-{/render}
- <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
- </td>
- </tr>
-</table>
-
-<input type="hidden" name="sambaTab" value="sambaTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
- <!--
- // Populate expiery dialog
- populate(document.mainform,document.mainform.sambaPwdMustChange);
- -->
-</script>
diff --git a/gosa-core/plugins/personal/samba/samba3.tpl b/gosa-core/plugins/personal/samba/samba3.tpl
+++ /dev/null
@@ -1,470 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
-
- <!-- Headline container -->
- <tr>
- <td colspan="2" style="width:50%; vertical-align:top;">
- <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"/> {t}Generic{/t}</h2>
- </td>
- </tr>
- <tr>
- <td style="vertical-align:top;">
- <table summary="">
- <tr>
- <td><label for="sambaHomePath">{t}Home directory{/t}</label></td>
- <td>
-{render acl=$sambaHomePathACL checkbox=$multiple_support checked=$use_sambaHomePath}
- <input id="sambaHomePath" name="sambaHomePath" size=30 maxlength=60 value="{$sambaHomePath}">
-{/render}
-{render acl=$sambaHomeDriveACL checkbox=$multiple_support checked=$use_sambaHomeDrive}
- <select size="1" name="sambaHomeDrive">
- <option disabled> </option>
- {html_options values=$drives output=$drives selected=$sambaHomeDrive}
- </select>
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="sambaDomainName">{t}Domain{/t}</label></td>
- <td>
-{render acl=$sambaDomainNameACL checkbox=$multiple_support checked=$use_sambaDomainName}
- <select id="sambaDomainName" size="1" name="sambaDomainName">
- {html_options values=$domains output=$domains selected=$sambaDomainName}
- </select>
-{/render}
- </td>
- </tr>
- </table>
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top;">
- <table summary="">
- <tr>
- <td><label for="">{t}Script path{/t}</label></td>
- <td>
-{render acl=$sambaLogonScriptACL checkbox=$multiple_support checked=$use_sambaLogonScript}
- <input id="sambaLogonScript" name="sambaLogonScript" size=35 maxlength=60 value="{$sambaLogonScript}">
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="">{t}Profile path{/t}</label></td>
- <td>
-{render acl=$sambaProfilePathACL checkbox=$multiple_support checked=$use_sambaProfilePath}
- <input class="center" id="sambaProfilePath" name="sambaProfilePath" size=35 maxlength=60 value="{$sambaProfilePath}">
-{/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<p class="seperator"> </p>
-
-<h2><img class="center" alt="" align="middle" src="images/display.png" /> {t}Terminal Server{/t}</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
- <td style="vertical-align:top;width:50%">
-
-{if $multiple_support}
- <input class="center" type=checkbox name="use_tslogin" id="use_tslogin" value="1"
- {if $use_tslogin} checked {/if}
- onClick="changeState('tslogin')">
- <input class="center" type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin}
- {if !$use_tslogin} disabled {/if}>
-{else}
-{render acl=$AllowLoginOnTerminalServerACL}
- <input class="center" type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin}
- onclick="
- changeState('CtxWFHomeDir');
- changeState('CtxWFHomeDirDrive');
- changeState('CtxWFProfilePath');
- changeState('inherit');
- changeTripleSelectState_2nd_neg('tslogin','inherit','CtxInitialProgram');
- changeTripleSelectState_2nd_neg('tslogin','inherit','CtxWorkDirectory');
- changeState('CtxMaxConnectionTimeF');
- changeState('CtxMaxDisconnectionTimeF');
- changeState('CtxMaxIdleTimeF');
- changeTripleSelectState('tslogin','CtxMaxConnectionTimeF','CtxMaxConnectionTime');
- changeTripleSelectState('tslogin','CtxMaxDisconnectionTimeF','CtxMaxDisconnectionTime');
- changeTripleSelectState('tslogin','CtxMaxIdleTimeF','CtxMaxIdleTime');
- changeState('connectclientdrives');
- changeState('connectclientprinters');
- changeState('defaultprinter');
- changeState('shadow');
- changeState('brokenconn');
- changeState('reconn');
- ">
-{/render}
-{/if}
- <i>{t}Allow login on terminal server{/t}</i>
- <table summary="">
- <tr>
- <td><label for="CtxWFHomeDir">{t}Home directory{/t}</label></td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFHomeDir}
- <input id="CtxWFHomeDir" name="CtxWFHomeDir" size=30 maxlength=60 value="{$CtxWFHomeDir}" {$tsloginstate}>
-{/render}
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFHomeDirDrive}
- <select size="1" id="CtxWFHomeDirDrive" name="CtxWFHomeDirDrive" {$tsloginstate}>
- <option disabled> </option>
- {html_options values=$drives output=$drives selected=$CtxWFHomeDirDrive}
- </select>
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="CtxWFProfilePath">{t}Profile path{/t}</label></td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFProfilePath}
- <input id="CtxWFProfilePath" name="CtxWFProfilePath" size=35 maxlength=60 value="{$CtxWFProfilePath}" {$tsloginstate}>
-{/render}
- </td>
- </tr>
- </table>
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top;">
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_inherit}
- <input class="center" type=checkbox id="inherit" name="inherit" {if $inheritstate} checked {/if}
- onClick="changeState('CtxInitialProgram');
- changeState('CtxWorkDirectory');"
-
- >
-{/render}
- <i>{t}Inherit client config{/t}</i>
- <table summary="">
- <tr>
- <td><label for="CtxInitialProgram">{t}Initial program{/t}</label></td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxInitialProgram}
- <input id="CtxInitialProgram" name="CtxInitialProgram" size=35 maxlength=60 value="{$CtxInitialProgram}" {$inheritstate}>
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="CtxWorkDirectory">{t}Working directory{/t}</label></td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWorkDirectory}
- <input id="CtxWorkDirectory" name="CtxWorkDirectory" size=35 maxlength=60 value='{$CtxWorkDirectory}' {$inheritstate}>
-{/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<p class="seperator"> </p>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
- <td style="vertical-align:top;">
- <i>{t}Timeout settings (in minutes){/t}</i>
- <table summary="">
- <tr>
- <td>
-{if $multiple_support}
-<input type="checkbox" name="use_CtxMaxConnectionTimeF" {if $use_CtxMaxConnectionTimeF} checked {/if}
- onClick="changeState('CtxMaxConnectionTimeF');" class="center"
- >
-{/if}
-{render acl=$AllowLoginOnTerminalServerACL}
- <input id="CtxMaxConnectionTimeF" type="checkbox" class="center" name="CtxMaxConnectionTimeF"
- {if !$use_CtxMaxConnectionTimeF && $multiple_support} disabled {/if}
- value="1" {$CtxMaxConnectionTimeF}
- onclick="changeState('CtxMaxConnectionTime')" {$tsloginstate}>
-{/render}
-
- <label for="CtxMaxConnectionTimeF">{t}Connection{/t}</label>
- </td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL}
- <input name="CtxMaxConnectionTime" id="CtxMaxConnectionTime" size=5 maxlength=5 value="{$CtxMaxConnectionTime}" {$tsloginstate}
- { if !$CtxMaxConnectionTimeF } disabled {/if}>
-{/render}
- </td>
- </tr>
- <tr>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxMaxDisconnectionTimeF}
- <input id="CtxMaxDisconnectionTimeF" type=checkbox name="CtxMaxDisconnectionTimeF" value="1" {$CtxMaxDisconnectionTimeF} onclick="changeState('CtxMaxDisconnectionTime')" {$tsloginstate} class="center">
-{/render}
- <label for="CtxMaxDisconnectionTimeF">{t}Disconnection{/t}</label>
- </td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL}
- <input name="CtxMaxDisconnectionTime" id="CtxMaxDisconnectionTime" size=5 maxlength=5 value="{$CtxMaxDisconnectionTime}" {$tsloginstate}
- { if !$CtxMaxDisconnectionTimeF } disabled {/if}>
-{/render}
- </td>
- </tr>
- <tr>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxMaxIdleTimeF}
- <input id="CtxMaxIdleTimeF" type=checkbox name="CtxMaxIdleTimeF" value="1" {$CtxMaxIdleTimeF} onclick="changeState('CtxMaxIdleTime')" {$tsloginstate} class="center">
-{/render}
- <label for="CtxMaxIdleTimeF">{t}IDLE{/t}</label>
- </td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL}
- <input name="CtxMaxIdleTime" id="CtxMaxIdleTime" size=5 maxlength=5 value="{$CtxMaxIdleTime}" {$tsloginstate}
- { if !$CtxMaxIdleTimeF } disabled {/if}>
-{/render}
- </td>
- </tr>
- </table>
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top;">
-
- <i>{t}Client devices{/t}</i>
- <table summary="">
- <tr>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_connectclientdrives}
- <input id="connectclientdrives" type=checkbox name="connectclientdrives" value="1" {$connectclientdrives} {$tsloginstate} class="center">
-{/render}
- <label for="connectclientdrives">{t}Connect client drives at logon{/t}</label>
- </td>
- </tr>
- <tr>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_connectclientprinters}
- <input id="connectclientprinters" type=checkbox name="connectclientprinters" value="1" {$connectclientprinters}{$tsloginstate} class="center">
-{/render}
- <label for="connectclientprinters">{t}Connect client printers at logon{/t}</label>
- </td>
- </tr>
- <tr>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_defaultprinter}
- <input id="defaultprinter" type=checkbox name="defaultprinter" value="1" {$defaultprinter} {$tsloginstate} class="center">
-{/render}
- <label for="defaultprinter">{t}Default to main client printer{/t}</label>
- </td>
- </tr>
- </table>
-
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top;width:50%">
- <i>{t}Miscellaneous{/t}</i>
- <table summary="">
- <tr>
- <td>
- <label for="shadow">{t}Shadowing{/t}</label>
- </td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_shadow}
- <select id="shadow" size="1" name="shadow" >
- {html_options options=$shadow selected=$shadowmode}
- </select>
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="brokenconn">{t}On broken or timed out{/t}</label></td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_brokenconn}
- <select id="brokenconn" size="1" name="brokenconn">
- {html_options options=$brokenconn selected=$brokenconnmode}
- </select>
-{/render}
- </td>
- </tr>
- <tr>
- <td><label for="reconn">{t}Reconnect if disconnected{/t}</label></td>
- <td>
-{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_reconn}
- <select id="reconn" size="1" name="reconn">
- {html_options options=$reconn selected=$reconnmode}
- </select>
-{/render}
- </td>
- </tr>
- </table>
-
- </td>
- </tr>
-</table>
-
-<p class="seperator"> </p>
-
-<h2><img class="center" alt="" align="middle" src="images/certs.png" /> {t}Access options{/t}</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <tr>
- <td style="width:50%; vertical-align:top;">
-{render acl=$sambaPwdCanChangeACL checkbox=$multiple_support checked=$use_allow_pwchange}
- <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP} class="center">
-{/render}
- <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
- <br>
-{render acl=$sambaAcctFlagsNACL checkbox=$multiple_support checked=$use_no_password_required}
- <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN} class="center">
-{/render}
- <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
- <br>
-{render acl=$sambaAcctFlagsLACL checkbox=$multiple_support checked=$use_temporary_disable}
- <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD} class="center">
-{/render}
- <label for="temporary_disable">{t}Lock samba account{/t}</label>
- <br>
-{render acl=$sambaPwdMustChangeACL checkbox=$multiple_support checked=$use_password_expires}
- <input id="password_expires" type=checkbox name="password_expires" value="1" {$flagsC} class="center">
-{/render}
- <label for="password_expires">{t}Password expires on{/t}</label>
-{render acl=$sambaPwdMustChangeACL}
- <select name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
- {html_options values=$days output=$days selected=$day}
- </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
- <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
- {html_options options=$months selected=$month}
- </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
- <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
- {html_options values=$years output=$years selected=$year}
- </select>
-{/render}
- <br>
-{render acl=$sambaLogonTimeACL checkbox=$multiple_support checked=$use_logon_time_set}
- <input id="logon_time_set" type=checkbox name="logon_time_set" value="1" {$flagsT} class="center">
-{/render}
- <label for="logon_time_set">{t}Limit Logon Time{/t}</label>
-{render acl=$sambaLogonTimeACL}
- <select name=sambaLogonTime_day onChange="createResult_sambaLogonTime(this.form,this.form.sambaLogonTime);">
- {html_options values=$sambaLogonTime_days output=$sambaLogonTime_days selected=$sambaLogonTime_day}
- </select>
-{/render}
-{render acl=$sambaLogonTimeACL}
- <select name=sambaLogonTime_month onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
- {html_options options=$sambaLogonTime_months output=$sambaLogonTime_months selected=$sambaLogonTime_month}
- </select>
-{/render}
-{render acl=$sambaLogonTimeACL}
- <select name=sambaLogonTime_year onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
- {html_options values=$sambaLogonTime_years output=$sambaLogonTime_years selected=$sambaLogonTime_year}
- </select>
-{/render}
- <br>
-{render acl=$sambaLogoffTimeACL checkbox=$multiple_support checked=$use_logoff_time_set}
- <input id="logoff_time_set" type=checkbox name="logoff_time_set" value="1" {$flagsO} class="center">
-{/render}
- <label for="logoff_time_set">{t}Limit Logoff Time{/t}</label>
-{render acl=$sambaLogoffTimeACL}
- <select name=sambaLogoffTime_day onChange="createResult_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
- {html_options values=$sambaLogoffTime_days output=$sambaLogoffTime_days selected=$sambaLogoffTime_day}
- </select>
-{/render}
-{render acl=$sambaLogoffTimeACL}
- <select name=sambaLogoffTime_month onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
- {html_options options=$sambaLogoffTime_months output=$sambaLogoffTime_months selected=$sambaLogoffTime_month}
- </select>
-{/render}
-{render acl=$sambaLogoffTimeACL}
- <select name=sambaLogoffTime_year onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
- {html_options values=$sambaLogoffTime_years output=$sambaLogoffTime_years selected=$sambaLogoffTime_year}
- </select>
-{/render}
- <br>
-
-{render acl=$sambaKickoffTimeACL checkbox=$multiple_support checked=$use_kickoff_time_set}
- <input id="kickoff_time_set" type=checkbox name="kickoff_time_set" value="1" {$flagsK} class="center">
-{/render}
- <label for="kickoff_time_set">{t}Account expires after{/t}</label>
-{render acl=$sambaKickoffTimeACL}
- <select name=sambaKickoffTime_day onChange="createResult_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
- {html_options values=$sambaKickoffTime_days output=$sambaKickoffTime_days selected=$sambaKickoffTime_day}
- </select>
-{/render}
-{render acl=$sambaKickoffTimeACL}
- <select name=sambaKickoffTime_month onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
- {html_options options=$sambaKickoffTime_months output=$sambaKickoffTime_months selected=$sambaKickoffTime_month}
- </select>
-{/render}
-{render acl=$sambaKickoffTimeACL}
- <select name=sambaKickoffTime_year onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
- {html_options values=$sambaKickoffTime_years output=$sambaKickoffTime_years selected=$sambaKickoffTime_year}
- </select>
-{/render}
- <br>
- <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
- <input type="hidden" name="sambaLogonTime" value="{$sambaLogonTime}">
- <input type="hidden" name="sambaLogoffTime" value="{$sambaLogoffTime}">
- <input type="hidden" name="sambaKickoffTime" value="{$sambaKickoffTime}">
-<br>
-{render acl=$sambaLogonHoursACL mode=read_active checkbox=$multiple_support checked=$use_SetSambaLogonHours}
- {t}Samba logon times{/t} <input type='submit' name='SetSambaLogonHours' value='{t}Edit settings...{/t}'>
-{/render}
-
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- </td>
- <td style="vertical-align:top;">
- <label for="workstation_list">{t}Allow connection from these workstations only{/t}</label>
- <br>
-
-{if $multiple_support}
- <input type="checkbox" name="use_workstation_list" {if $use_workstation_list} checked {/if} class="center"
- onClick="changeState('workstation_list');">
- <select {if $multiple_support && !$use_workstation_list} disabled {/if}
- id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
-
- {foreach from=$multiple_workstations item=item key=key}
- {if $item.UsedByAllUsers}
- <option value="{$key}">{$item.Name} ({t}Used by all users{/t})</option>
- {else}
- <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;'
- value="{$key}">{$item.Name} ({t}Used by some users{/t})</option>
- {/if}
- {/foreach}
- </select>
- <br>
- <input type="submit" value="{t}Add{/t}" name="add_ws">
- <input type="submit" value="{t}Delete{/t}" name="delete_ws">
-{else}
- {render acl=$sambaUserWorkstationsACL}
- <select id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
- {html_options values=$workstations output=$workstations}
- </select>
- {/render}
- <br>
- {render acl=$sambaUserWorkstationsACL}
- <input type="submit" value="{t}Add{/t}" name="add_ws">
- {/render}
- {render acl=$sambaUserWorkstationsACL}
- <input type="submit" value="{t}Delete{/t}" name="delete_ws">
- {/render}
-{/if}
- </td>
- </tr>
-</table>
-
-<input type="hidden" name="sambaTab" value="sambaTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
- <!--
- // Populate expiery dialog
- populate(document.mainform,document.mainform.sambaPwdMustChange);
-
- // Populate samba Time dialogs
- populate_sambaLogonTime(document.mainform,document.mainform.sambaLogonTime);
- populate_sambaLogoffTime(document.mainform,document.mainform.sambaLogoffTime);
- populate_sambaKickoffTime(document.mainform,document.mainform.sambaKickoffTime);
- -->
-</script>
diff --git a/gosa-core/plugins/personal/samba/samba3_workstations.tpl b/gosa-core/plugins/personal/samba/samba3_workstations.tpl
+++ /dev/null
@@ -1,42 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4">
-<tr>
- <td style="vertical-align:top;width:600px">
- <div class="contentboxh" style="height:20px;">
- <p class="contentboxh" style="font-size:12px">
- <b><label for="wslist">{t}Select workstations to add{/t}</label> {$hint}</b><br />
- </p>
- </div>
- <div class="contentboxb">
- <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
- <select id="wslist" style="width:600px; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
- {html_options values=$wslist output=$wslist}
- </select>
- </p>
- </div>
- </td>
- <td style="vertical-align:top;">
- <div class="contentboxh" style="height:20px;">
- <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]">
- <b>{t}Filters{/t}</b></p>
- </div>
- <div class="contentboxb">
- <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
- {$alphabet}
- </table>
- <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td><img class="center" alt="{t}Display workstations of department{/t}" src="{$tree_image}" align="middle">
- <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
- {html_options options=$deplist selected=$depselect}
- </select></td></tr></table>
- <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="18"><img class="center" alt="" src="{$search_image}" align="middle"> </td>
- <td><input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
- {$apply}
- </div>
- </td>
-</tr>
-</table>
-
-<p class="plugbottom">
- <input type=submit name="add_ws_finish" value="{t}Add{/t}">
-
- <input type=submit name="add_ws_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/gosa-core/plugins/personal/samba/sambaLogonHours.tpl b/gosa-core/plugins/personal/samba/sambaLogonHours.tpl
+++ /dev/null
@@ -1,101 +0,0 @@
-
-<!-- Javacript function used to switch a complete row or col of selected hours -->
-<script language="javascript" type="text/javascript">
- {literal}
- var $regex = new Array();
- function toggle_chk($reg)
- {
- if(!$regex[$reg]){
- $regex[$reg] =1;
- }
- $regex[$reg] *= -1;
- if($regex[$reg] == 1){
- chk_set_all($reg,true);
- }else{
- chk_set_all($reg,false);
- }
- }
- {/literal}
-</script>
-
-<h1>{t}Specify the hours this user is allowed to log in{/t}</h1>
-<br>
-
-<table cellspacing=0 cellpadding=0 style='border: solid 1px #B0B0B0; background-color: #EEEEEE; width :100%;' >
- <tr>
- <td> </td>
- <td colspan=24 style='text-align:center;height:24px;border-bottom: solid 1px #B0B0B0;'><b>{t}Hour{/t}</b></td>
- </tr>
- <tr>
- <td style='text-align: left;' class='list0'> </td>
- {foreach from=$Hours item=hours key=key_hours}
- {if (($hours)%2) == 0 }
- <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
- {else}
- <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0;">
- {/if}
- {$hours}
- </td>
- {/foreach}
- </tr>
-
- <!-- Add toggle buttons for hours -->
- <tr>
- <td style='text-align: left;' class='list0'>
-
- </td>
- {foreach from=$Hours item=hours key=key_hours}
- {if (($hours)%2) == 0 }
- <td style="text-align:center; height: 22px; background-color: rgb(226, 226, 226); text-align: right;">
- {else}
- <td style="text-align:center; height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0; text-align: right;">
- {/if}
-
- <input type='button' onClick="toggle_chk('^day_[0-9]*_{$hours}$');" value='+/-' style='width:100%;'>
- </td>
- {/foreach}
- <td>
-
- <input type='button' onClick="toggle_chk('^day_[0-9]*_[0-9]*$');" value='+/-' style='width:100%;'>
- </td>
- </tr>
-
- <!-- Add Entries -->
-{foreach from=$Matrix item=days key=key_day}
- <tr>
- <td class='list0'>
- <b>{$Days[$key_day]}</b>
- </td>
- {foreach from=$days item=hours key=key_hour}
- {if (($key_hour)%2) == 0 }
- <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
- {else}
- <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px;">
- {/if}
- {if $Matrix[$key_day].$key_hour}
- <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' checked >
- {else}
- <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' >
- {/if}
- </td>
- {/foreach}
-
- <!-- Add toggle button for days -->
- <td>
- <input type='button' onClick="toggle_chk('^day_{$key_day}_[0-9]*$')" value='+/-' style='padding:0px;margin:0px;'>
- </td>
- </tr>
-{/foreach}
-</table>
-<br>
-<input type='hidden' name='sambaLogonHoursPosted' value='1'>
-<br>
-<p class="plugbottom">
- <input type=submit name="save_logonHours" value="{t}Apply{/t}">
-
- <input type=submit name="cancel_logonHours" value="{t}Cancel{/t}">
-</p>
-
-<!--
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/gosa-plugins/samba/personal/samba/class_sambaAccount.inc b/gosa-plugins/samba/personal/samba/class_sambaAccount.inc
--- /dev/null
@@ -0,0 +1,1543 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2004-2005 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class sambaAccount extends plugin
+{
+ /* Definitions */
+ var $plHeadline= "Samba";
+ var $plDescription= "This does something";
+ var $view_logged = FALSE;
+
+ /* CLI vars */
+ var $cli_summary= "Manage users samba account";
+ var $cli_description= "Some longer text\nfor help";
+ var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* Switch for Samba version */
+ var $samba3= FALSE;
+ var $uidNumber= 65535;
+ var $gidNumber= 65535;
+
+ /* Samba 2 attributes */
+ var $pwdLastSet= "0";
+ var $logonTime= "0";
+ var $logoffTime= "2147483647";
+ var $kickoffTime= "2147483647";
+ var $pwdCanChange= "0";
+ var $pwdMustChange= "0";
+ var $password_expires= 0;
+ var $acctFlags= "[UX ]";
+ var $smbHome= "";
+ var $homeDrive= "";
+ var $scriptPath= "";
+ var $profilePath= "";
+ var $rid= "";
+ var $primaryGroupID= "";
+
+ /* Samba 3 attributes */
+ var $SID= "";
+ var $ridBase= 0;
+ var $sambaSID= "";
+ var $sambaPwdLastSet= "0";
+ var $sambaLogonTime= "0";
+ var $sambaLogoffTime= "2147483647";
+ var $sambaKickoffTime= "2147483647";
+ var $sambaPwdCanChange= "";
+ var $sambaPwdMustChange= "0";
+ var $sambaAcctFlags= "[UX ]";
+ var $sambaHomePath= "";
+ var $sambaHomeDrive= "";
+ var $sambaLogonScript= "";
+ var $sambaProfilePath= "";
+ var $sambaPrimaryGroupSID= "";
+ var $sambaDomainName= "";
+ var $sambaUserWorkstations= "";
+ var $sambaBadPasswordCount= "";
+ var $sambaBadPasswordTime= "";
+ var $sambaPasswordHistory= "";
+ var $sambaLogonHours= "";
+ var $orig_sambaDomainName= "";
+ var $sambaMungedDial= "";
+ var $mungedObject;
+
+ /* Helper */
+ var $show_ws_dialog= FALSE;
+ var $logon_time_set= 0;
+ var $logoff_time_set= 0;
+ var $kickoff_time_set= 0;
+
+ /* attribute list for save action */
+ var $ctxattributes= array();
+ var $attributes= array();
+ var $objectclasses= array();
+
+ var $uid= "";
+ var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName");
+
+ var $multiple_support = TRUE;
+
+ /* Only used for multiple edit */
+ var $temporary_disable = FALSE;
+ var $no_password_required = FALSE;
+ var $multiple_sambaUserWorkstations = array();
+
+ function sambaAccount (&$config, $dn= NULL)
+ {
+ /* Load attributes depending on the samba version */
+ $this->samba3= ($config->current['SAMBAVERSION'] == 3);
+
+ if ($this->samba3){
+ $this->attributes= array ("sambaSID", "sambaPwdLastSet", "sambaLogonTime",
+ "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange",
+ "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial",
+ "sambaHomePath", "sambaHomeDrive", "sambaLogonScript",
+ "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName",
+ "sambaUserWorkstations", "sambaPasswordHistory",
+ "sambaLogonHours", "sambaBadPasswordTime",
+ "sambaBadPasswordCount");
+ $this->objectclasses= array ("sambaSamAccount");
+ $this->mungedObject= new sambaMungedDial;
+ $this->ctxattributes= $this->mungedObject->ctxattributes;
+ } else {
+ $this->attributes= array ("pwdLastSet", "logonTime", "logoffTime", "kickoffTime",
+ "pwdCanChange", "pwdMustChange", "acctFlags", "profilePath", "uid",
+ "smbHome", "homeDrive", "scriptPath", "rid", "primaryGroupID");
+ $this->objectclasses= array ("sambaAccount");
+ }
+
+ plugin::plugin ($config, $dn);
+
+ /* Setting uid to default */
+ if(isset($this->attrs['uid'][0])){
+ $this->uid = $this->attrs['uid'][0];
+ }
+
+ /* Get samba Domain in case of samba 3 */
+ if ($this->samba3 && $this->sambaSID != ""){
+ $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase","sambaDomainName"));
+ if ($ldap->count() != 0){
+ $attrs= $ldap->fetch();
+ $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
+ if ($this->sambaDomainName == ""){
+ $this->sambaDomainName= $attrs['sambaDomainName'][0];
+ }
+ } else {
+ if ($this->sambaDomainName == ""){
+ $this->sambaDomainName= "DEFAULT";
+ }
+ $this->ridBase= $this->config->current['RIDBASE'];
+ $this->SID= $this->config->current['SID'];
+ }
+
+ /* Save in order to compare later on */
+ $this->orig_sambaDomainName= $this->sambaDomainName;
+ }
+
+ /* Fill mungedDial field */
+ if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
+ $this->mungedObject->load($this->sambaMungedDial);
+ }
+
+ /* Password expiery */
+ if(isset($this->attrs['sambaPwdMustChange']) &&
+ $this->attrs['sambaPwdMustChange'][0] != 0){
+ $this->password_expires= 1;
+ }
+
+ if(isset($this->attrs['sambaLogonTime']) && ! (
+ $this->attrs['sambaLogonTime'][0] == 0 ||
+ $this->attrs['sambaLogonTime'][0] == 2147483647
+ )){
+ $this->logon_time_set= 1;
+ }
+ if(isset($this->attrs['sambaLogoffTime']) && ! (
+ $this->attrs['sambaLogoffTime'][0] == 0 ||
+ $this->attrs['sambaLogoffTime'][0] == 2147483647
+ )){
+ $this->logoff_time_set= 1;
+ }
+
+ /* Account expiery */
+ if(isset($this->attrs['sambaKickoffTime']) && ! (
+ $this->attrs['sambaKickoffTime'][0] == 0 ||
+ $this->attrs['sambaKickoffTime'][0] == 2147483647
+ )){
+ $this->kickoff_time_set= 1;
+ }
+
+ /* Get global filter config */
+ if (!session::is_set("sambafilter")){
+ $ui= get_userinfo();
+ $base= get_base_from_people($ui->dn);
+ $sambafilter= array( "depselect" => $base, "regex" => "*");
+ session::set("sambafilter", $sambafilter);
+ }
+
+ /* Save initial account state */
+ $this->initially_was_account= $this->is_account;
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Log view */
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","users/".get_class($this),$this->dn);
+ }
+
+ /* Do we need to flip is_account state? */
+ if (isset($_POST['modify_state'])){
+ $this->is_account= !$this->is_account;
+ }
+ /* Do we represent a valid account? */
+ if (!$this->is_account && $this->parent === NULL){
+ $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\"> <b>".
+ _("This account has no samba extensions.")."</b>";
+ $display.= back_to_main();
+ return ($display);
+ }
+
+ $display ="";
+ if(!$this->multiple_support_active){
+
+ /* Show tab dialog headers */
+ $display= "";
+ if ($this->parent !== NULL){
+ if ($this->is_account){
+ $display= $this->show_disable_header(_("Remove samba account"),
+ _("This account has samba features enabled. You can disable them by clicking below."));
+ } else {
+ $obj= $this->parent->by_object['posixAccount'];
+
+ /* Samba3 dependency on posix accounts are enabled
+ in the moment, because I need to rely on unique
+ uidNumbers. There'll be a better solution later
+ on. */
+ if ($obj->is_account){
+ $display= $this->show_enable_header(_("Create samba account"),
+ _("This account has samba features disabled. You can enable them by clicking below."));
+ } else {
+ $display= $this->show_enable_header(_("Create samba account"),
+ _("This account has samba features disabled. Posix features are needed for samba accounts, enable them first."), TRUE);
+ }
+ return ($display);
+ }
+ }
+ }
+
+ $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
+
+ /* Open Samaba Logong hours dialog */
+ if(isset($_POST['SetSambaLogonHours']) && $this->samba3 && $this->acl_is_writeable("sambaLogonHours")){
+ $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours);
+ }
+
+ /* Cancel dialog */
+ if(isset($_POST['cancel_logonHours'])){
+ $this->dialog = FALSE;
+ }
+
+ /* Save selected logon hours */
+ if(isset($_POST['save_logonHours'])){
+ $this->dialog->save_object();
+ if($this->acl_is_writeable("sambaLogonHours")){
+ $this->sambaLogonHours = $this->dialog->save();
+ }
+ $this->dialog = FALSE;
+ }
+
+ /* Display dialog */
+ if((isset($this->dialog)) && (is_object($this->dialog))){
+ $this->dialog->save_object();
+ return($this->dialog->execute());
+ }
+
+ /* Prepare templating */
+ $smarty= get_smarty();
+
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $var => $rest){
+ $smarty->assign($var."ACL",$this->getacl($var,$SkipWrite));
+ }
+
+ if ($this->sambaPwdMustChange=="0"){
+ $date= getdate();
+ } else {
+ $date= getdate($this->sambaPwdMustChange);
+ }
+
+ if ($this->sambaLogonTime=="2147483647" || $this->sambaLogonTime=="0"){
+ $sambaLogonTime_date= getdate();
+ } else {
+ $sambaLogonTime_date= getdate($this->sambaLogonTime);
+ }
+
+ if ($this->sambaLogoffTime=="2147483647" || $this->sambaLogoffTime=="0"){
+ $sambaLogoffTime_date= getdate();
+ } else {
+ $sambaLogoffTime_date= getdate($this->sambaLogoffTime);
+ }
+
+ if ($this->sambaKickoffTime=="2147483647" || $this->sambaKickoffTime=="0"){
+ $sambaKickoffTime_date= getdate();
+ } else {
+ $sambaKickoffTime_date= getdate($this->sambaKickoffTime);
+ }
+
+ /* Remove user workstations? */
+ if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
+
+ if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
+
+ if($this->multiple_support_active){
+ foreach($_POST['workstation_list'] as $name){
+ if(isset($this->multiple_sambaUserWorkstations[trim($name)])){
+ unset($this->multiple_sambaUserWorkstations[trim($name)]);
+ }
+ }
+ }else{
+ $tmp= $this->sambaUserWorkstations;
+ foreach($_POST['workstation_list'] as $name){
+ $tmp= preg_replace("/$name/", '', $tmp);
+ $this->is_modified= TRUE;
+ }
+ $tmp= preg_replace('/,+/', ',', $tmp);
+ $this->sambaUserWorkstations= trim($tmp, ',');
+ }
+ }
+ }
+
+ /* Add user workstation? */
+ if (isset($_POST["add_ws"])){
+ if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
+ $this->show_ws_dialog= TRUE;
+ $this->dialog= TRUE;
+ }
+ }
+
+ /* Add user workstation finished? */
+ if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
+ $this->show_ws_dialog= FALSE;
+ $this->dialog= FALSE;
+ }
+
+ /* Add user workstation? */
+ if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
+
+ if($this->multiple_support_active){
+ foreach($_POST['wslist'] as $ws){
+ $this->multiple_sambaUserWorkstations[trim($we)] = array("Name" => trim($ws), "UsedByAllUsers" => TRUE);
+ }
+ }else{
+ $tmp= $this->sambaUserWorkstations;
+ foreach($_POST['wslist'] as $ws){
+ $tmp.= ",$ws";
+ }
+ $tmp= preg_replace('/,+/', ',', $tmp);
+ $this->sambaUserWorkstations= trim($tmp, ',');
+ }
+ $this->is_modified= TRUE;
+ }
+
+ /* Show ws dialog */
+ if ($this->show_ws_dialog){
+
+ /* Save data */
+ $sambafilter= session::get("sambafilter");
+ foreach( array("depselect", "regex") as $type){
+ if (isset($_POST[$type])){
+ $sambafilter[$type]= $_POST[$type];
+ }
+ }
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
+ }
+ $sambafilter['regex']= $s;
+ }
+ session::set("sambafilter", $sambafilter);
+
+ /* Get workstation list */
+ $exclude= "";
+
+ if($this->multiple_support_active){
+ foreach($this->multiple_sambaUserWorkstations as $ws){
+ if($ws['UsedByAllUsers']){
+ $exclude.= "(cn=".$ws['Name']."$)";
+ }
+ }
+ }else{
+ foreach(split(',', $this->sambaUserWorkstations) as $ws){
+ $exclude.= "(cn=$ws$)";
+ }
+ }
+ if ($exclude != ""){
+ $exclude= "(!(|$exclude))";
+ }
+ $regex= $sambafilter['regex'];
+ $filter= "(&(objectClass=sambaSAMAccount)$exclude(uid=*$)(|(uid=$regex)(cn=$regex)))";
+ $res= get_list($filter, "winworkstation", $sambafilter['depselect'], array("uid"), GL_SUBSEARCH | GL_SIZELIMIT);
+
+ $wslist= array();
+ foreach ($res as $attrs){
+ $wslist[]= preg_replace('/\$/', '', $attrs['uid'][0]);
+ }
+ asort($wslist);
+
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("alphabet", generate_alphabet());
+ foreach( array("depselect", "regex") as $type){
+ $smarty->assign("$type", $sambafilter[$type]);
+ }
+ $smarty->assign("hint", print_sizelimit_warning());
+ $smarty->assign("wslist", $wslist);
+ $smarty->assign("apply", apply_filter());
+ $display= $smarty->fetch (get_template_path('samba3_workstations.tpl', TRUE,
+ dirname(__FILE__)));
+ return ($display);
+ }
+
+ /* Fill calendar */
+ $days= array();
+ for($d= 1; $d<32; $d++){
+ $days[]= $d;
+ }
+ $years= array();
+ for($y= $date['year']-4; $y<$date['year']+4; $y++){
+ $years[]= $y;
+ }
+ $months= array(_("January"), _("February"), _("March"), _("April"),
+ _("May"), _("June"), _("July"), _("August"), _("September"),
+ _("October"), _("November"), _("December"));
+ $smarty->assign("day", $date["mday"]);
+ $smarty->assign("days", $days);
+ $smarty->assign("months", $months);
+ $smarty->assign("month", $date["mon"]-1);
+ $smarty->assign("years", $years);
+ $smarty->assign("year", $date["year"]);
+
+ $sambaLogonTime_days= array();
+ for($d= 1; $d<32; $d++){
+ $sambaLogonTime_days[]= $d;
+ }
+ $sambaLogonTime_years= array();
+ for($y= $date['year']-4; $y<$date['year']+4; $y++){
+ $sambaLogonTime_years[]= $y;
+ }
+ $sambaLogonTime_months= array(_("January"), _("February"), _("March"), _("April"),
+ _("May"), _("June"), _("July"), _("August"), _("September"),
+ _("October"), _("November"), _("December"));
+ $smarty->assign("sambaLogonTime_day", $sambaLogonTime_date["mday"]);
+ $smarty->assign("sambaLogonTime_days", $sambaLogonTime_days);
+ $smarty->assign("sambaLogonTime_months", $sambaLogonTime_months);
+ $smarty->assign("sambaLogonTime_month", $sambaLogonTime_date["mon"]-1);
+ $smarty->assign("sambaLogonTime_years", $sambaLogonTime_years);
+ $smarty->assign("sambaLogonTime_year", $sambaLogonTime_date["year"]);
+
+ $sambaLogoffTime_days= array();
+ for($d= 1; $d<32; $d++){
+ $sambaLogoffTime_days[]= $d;
+ }
+ $sambaLogoffTime_years= array();
+ for($y= $date['year']-4; $y<$date['year']+4; $y++){
+ $sambaLogoffTime_years[]= $y;
+ }
+ $sambaLogoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
+ _("May"), _("June"), _("July"), _("August"), _("September"),
+ _("October"), _("November"), _("December"));
+ $smarty->assign("sambaLogoffTime_day", $sambaLogoffTime_date["mday"]);
+ $smarty->assign("sambaLogoffTime_days", $sambaLogoffTime_days);
+ $smarty->assign("sambaLogoffTime_months", $sambaLogoffTime_months);
+ $smarty->assign("sambaLogoffTime_month", $sambaLogoffTime_date["mon"]-1);
+ $smarty->assign("sambaLogoffTime_years", $sambaLogoffTime_years);
+ $smarty->assign("sambaLogoffTime_year", $sambaLogoffTime_date["year"]);
+
+ $sambaKickoffTime_days= array();
+ for($d= 1; $d<32; $d++){
+ $sambaKickoffTime_days[]= $d;
+ }
+ $sambaKickoffTime_years= array();
+ for($y= $date['year']-4; $y<$date['year']+4; $y++){
+ $sambaKickoffTime_years[]= $y;
+ }
+ $sambaKickoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
+ _("May"), _("June"), _("July"), _("August"), _("September"),
+ _("October"), _("November"), _("December"));
+ //$smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]-1);
+ $smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]); // hickert
+ $smarty->assign("sambaKickoffTime_days", $sambaKickoffTime_days);
+ $smarty->assign("sambaKickoffTime_months", $sambaKickoffTime_months);
+ $smarty->assign("sambaKickoffTime_month", $sambaKickoffTime_date["mon"]-1);
+ $smarty->assign("sambaKickoffTime_years", $sambaKickoffTime_years);
+ $smarty->assign("sambaKickoffTime_year", $sambaKickoffTime_date["year"]);
+
+ /* Fill boxes */
+ if ($this->samba3){
+ $domains= array();
+ foreach($this->config->data['SERVERS']['SAMBA'] as $name => $content){
+ $domains[]= $name;
+ }
+ $smarty->assign("domains", $domains);
+ }
+ $letters= array();
+ for ($i= 68; $i<91; $i++){
+ $letters[]= chr($i).":";
+ }
+ $smarty->assign("drives", $letters);
+
+ /* Fill terminal server settings */
+ if ($this->samba3){
+ foreach ($this->ctxattributes as $attr){
+ /* Fill common attributes */
+ if (isset($this->mungedObject->ctx[$attr])){
+ $smarty->assign("$attr", $this->mungedObject->ctx[$attr]);
+ // Set field to blank if value is 0
+ if(in_array($attr, array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime"))) {
+ if($this->mungedObject->ctx[$attr] == 0) {
+ $smarty->assign("$attr", "");
+ }
+ }
+ } else {
+ $smarty->assign("$attr", "");
+ }
+ }
+
+ /* Assign enum values for preset items */
+ $shadowModeVals= array( "0" => _("disabled"),
+ "1" => _("input on, notify on"),
+ "2" => _("input on, notify off"),
+ "3" => _("input off, notify on"),
+ "4" => _("input off, nofify off"));
+
+ $brokenConnModeVals= array( "0" => _("disconnect"),
+ "1" => _("reset"));
+
+ $reConnModeVals= array( "0" => _("from any client"),
+ "1" => _("from previous client only"));
+
+ /* Fill preset items */
+ $smarty->assign("shadow", $shadowModeVals);
+ $smarty->assign("brokenconn", $brokenConnModeVals);
+ $smarty->assign("reconn", $reConnModeVals);
+
+ /* Fill preset items with values */
+ $smarty->assign("shadowmode", $this->mungedObject->getShadow());
+ $smarty->assign("brokenconnmode", $this->mungedObject->getBrokenConn());
+ $smarty->assign("reconnmode", $this->mungedObject->getReConn());
+
+ if(session::get('js')){
+ /* Set form elements to disabled/enable state */
+ $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
+
+ $smarty->assign("inheritstate", "");
+ if($this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
+ $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
+ }
+ }else{
+ $smarty->assign("tsloginstate", "");
+ $smarty->assign("inheritstate", "");
+ }
+
+ /* Set checkboxes to checked or unchecked state */
+ $smarty->assign("tslogin", $this->mungedObject->getTsLogin()?"checked":"");
+ $smarty->assign("inherit", $this->mungedObject->getInheritMode()?"checked":"");
+ $smarty->assign("connectclientdrives",
+ $this->mungedObject->getConnectClientDrives()?"checked":"");
+ $smarty->assign("connectclientprinters",
+ $this->mungedObject->getConnectClientPrinters()?"checked":"");
+ $smarty->assign("defaultprinter",
+ $this->mungedObject->getDefaultPrinter()?"checked":"");
+ $smarty->assign("CtxMaxConnectionTimeF",
+ $this->mungedObject->getCtxMaxConnectionTimeF()?"checked":"");
+ $smarty->assign("CtxMaxDisconnectionTimeF",
+ $this->mungedObject->getCtxMaxDisconnectionTimeF()?"checked":"");
+ $smarty->assign("CtxMaxIdleTimeF",
+ $this->mungedObject->getCtxMaxIdleTimeF()?"checked":"");
+
+
+ /* Fill sambaUserWorkstations */
+ $ws= split(",", $this->sambaUserWorkstations);
+ sort($ws);
+
+ /* Tidy checks for empty option, and smarty will produce one if array[0]="" */
+ if(($ws[0]=="")&&(count($ws)==1)) $ws=array();
+
+ if($this->multiple_support_active){
+ $smarty->assign("multiple_workstations",$this->multiple_sambaUserWorkstations);
+ }
+
+ $smarty->assign("workstations", $ws);
+ }
+
+ /* Variables */
+ foreach($this->attributes as $val){
+ $smarty->assign("$val", $this->$val);
+ }
+
+ /* 'sambaAcctFlags' checkboxes */
+ /* Check for 'lock-account'-flag: 'D' or 'L' */
+ if (is_integer(strpos($this->sambaAcctFlags, "D")) ||
+ is_integer(strpos($this->sambaAcctFlags, "L"))) {
+ $smarty->assign("flagsD", "checked");
+ } else {
+ $smarty->assign("flagsD", "");
+ }
+
+ /* Check for no_password_required flag 'N' */
+ if (is_integer(strpos($this->sambaAcctFlags, "N"))) {
+ $smarty->assign("flagsN", "checked");
+ } else {
+ $smarty->assign("flagsN", "");
+ }
+
+ 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 {
+ $smarty->assign("flagsC", "");
+ }
+ if ($this->logon_time_set=="1"){
+ $smarty->assign("flagsT", "checked");
+ } else {
+ $smarty->assign("flagsT", "");
+ }
+ if ($this->logoff_time_set=="1"){
+ $smarty->assign("flagsO", "checked");
+ } else {
+ $smarty->assign("flagsO", "");
+ }
+ if ($this->kickoff_time_set=="1"){
+ $smarty->assign("flagsK", "checked");
+ } else {
+ $smarty->assign("flagsK", "");
+ }
+
+
+ /* In case of javascript, disable some fields on demand */
+ if ($this->samba3){
+ foreach($this->mungedObject->getOnDemandFlags() as $key => $value) {
+ $smarty->assign("$key", "$value");
+ }
+ }
+
+
+ foreach($this->attributes as $attr){
+ if(in_array($attr,$this->multi_boxes)){
+ $smarty->assign("use_".$attr,TRUE);
+ }else{
+ $smarty->assign("use_".$attr,FALSE);
+ }
+ }
+ foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath",
+ "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
+ "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
+ "onnectclientprinters","defaultprinter","shadow","brokenconn",
+ "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
+ "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
+ "workstation_list") as $attr){
+ if(in_array($attr,$this->multi_boxes)){
+ $smarty->assign("use_".$attr,TRUE);
+ }else{
+ $smarty->assign("use_".$attr,FALSE);
+ }
+ }
+
+ if($this->multiple_support_active){
+ $smarty->assign("tsloginstate","");
+ }
+
+ /* Show main page */
+ $smarty->assign("multiple_support",$this->multiple_support_active);
+ if ($this->samba3){
+ $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__)));
+ } else {
+ $display.= $smarty->fetch (get_template_path('samba2.tpl', TRUE, dirname(__FILE__)));
+ }
+
+ return ($display);
+ }
+
+ function remove_from_parent()
+ {
+ /* Cancel if there's nothing to do here */
+ if (!$this->initially_was_account){
+ return;
+ }
+
+ /* include global link_info */
+ $ldap= $this->config->get_ldap_link();
+
+ plugin::remove_from_parent();
+
+ /* Keep uid attribute for gosaAccount */
+ unset($this->attrs['uid']);
+ unset($this->attrs['uidNumber']);
+ unset($this->attrs['gidNumber']);
+
+ /* Remove objectClass for sambaIdmapEntry */
+ $tmp= array();
+ for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
+ if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
+ $tmp[]= $this->attrs['objectClass'][$i];
+ }
+ }
+ $this->attrs['objectClass']= $tmp;
+
+ @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+ $this->attributes, "Save");
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/samba account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ $this->handle_post_events("remove", array("uid" => $this->uid));
+ }
+
+
+ /* Check for input problems */
+ function check()
+ {
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
+ if ($this->samba3){
+
+ /* Strings */
+ foreach (array( "sambaHomePath" => _("Home directory"),
+ "sambaProfilePath" => _("Profile path")) as $key => $val){
+ if (!$this->mungedObject->is_samba_path($this->$key)){
+ $message[]= sprintf(_("The value specified as '%s' contains invalid characters!"), $val);
+ }
+ }
+
+ /* Numeric values */
+ foreach (array( "CtxMaxConnectionTime" => _("Connection"),
+ "CtxMaxDisconnectionTime" => _("Disconnection"),
+ "CtxMaxIdleTime" => _("IDLE")) as $key => $val){
+
+ if (isset($this->mungedObject->ctx[$key]) && !tests::is_id($this->mungedObject->ctx[$key]) && $val != 0){
+ $message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
+ }
+ }
+
+ /* Too many workstations? Windows usrmgr only supports eight */
+ if (substr_count($this->sambaUserWorkstations, ",") >= 8){
+ $message[]= _("The windows user manager only allows eight clients. You've specified more than eight.");
+ }
+ }
+
+ return ($message);
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+
+ $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
+
+ /* We only care if we are on the sambaTab... */
+ if (isset($_POST['sambaTab'])){
+ plugin::save_object();
+
+ /* Take care about access options */
+ if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
+ if ($this->samba3){
+ $attrname= "sambaPwdCanChange";
+ } else {
+ $attrname= "pwdCanChange";
+ }
+ if (isset($_POST["allow_pwchange"]) && $_POST["allow_pwchange"] == 1){
+ $tmp= 1;
+ } else {
+ $tmp= 0;
+ }
+ if ($this->$attrname != $tmp){
+ $this->is_modified= TRUE;
+ }
+ $this->pwdCanChange= $tmp;
+ $this->sambaPwdCanChange= $tmp;
+ }
+ $tmp= "UX";
+ $this->no_password_required = FALSE;
+ if (isset($_POST["no_password_required"])){
+ if ($_POST["no_password_required"] == 1){
+ $tmp.= "N";
+ $this->no_password_required = TRUE;
+ }
+ }
+ if (isset($_POST["password_expires"])){
+ if ($_POST["password_expires"] == 1){
+ $this->password_expires= 1;
+ }
+ } else {
+ $this->password_expires= 0;
+ }
+ $this->temporary_disable = FALSE;
+ if (isset($_POST["temporary_disable"])){
+ if ($_POST["temporary_disable"] == 1){
+ $this->temporary_disable = TRUE;
+ if (is_integer(strpos($this->sambaAcctFlags, "L"))) {
+ $tmp.= "L";
+ } else {
+ $tmp.= "D";
+ }
+ }
+ }
+ if (isset($_POST["logon_time_set"])){
+ if ($_POST["logon_time_set"] == 1){
+ $this->logon_time_set= 1;
+ }
+ } else {
+ $this->logon_time_set= 0;
+ }
+ if (isset($_POST["logoff_time_set"])){
+ if ($_POST["logoff_time_set"] == 1){
+ $this->logoff_time_set= 1;
+ }
+ } else {
+ $this->logoff_time_set= 0;
+ }
+ if (isset($_POST["kickoff_time_set"])){
+ if ($_POST["kickoff_time_set"] == 1){
+ $this->kickoff_time_set= 1;
+ }
+ } else {
+ $this->kickoff_time_set= 0;
+ }
+
+ $fill= "";
+ for ($i= strlen($tmp); $i<12; $i++){
+ $fill.= " ";
+ }
+
+ $tmp= "[$tmp$fill]";
+
+ /* Only save if acl's are set */
+ if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
+ if ($this->samba3){
+ $attrname= "sambaAcctFlags";
+ } else {
+ $attrname= "acctFlags";
+ }
+ if ($this->$attrname != $tmp){
+ $this->is_modified= TRUE;
+ }
+ $this->$attrname= $tmp;
+ }
+
+ /* Save sambaDomain attribute */
+ if ($this->acl_is_writeable("sambaDomainName",$SkipWrite) && $this->samba3 && isset ($_POST['sambaDomainName'],$SkipWrite)){
+ $this->sambaDomainName= validate($_POST['sambaDomainName']);
+ }
+
+ /* Save CTX values */
+ if ($this->samba3){
+
+ /* Save obvious values */
+ foreach($this->ctxattributes as $val){
+ if (isset($_POST[$val]) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
+ if (get_magic_quotes_gpc()) {
+ $this->mungedObject->ctx[$val]= stripcslashes(validate($_POST[$val]));
+ } else {
+ $this->mungedObject->ctx[$val]= validate($_POST[$val]);
+ }
+ }
+ }
+
+ /* Save checkbox states. */
+ $this->mungedObject->setTsLogin(!isset($_POST['tslogin'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ // Need to do some index checking to avoid messages like "index ... not found"
+ if(isset($_POST['brokenconn'])) {
+ $this->mungedObject->setBrokenConn($_POST['brokenconn'] == '1'
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ }
+ if(isset($_POST['reconn'])) {
+ $this->mungedObject->setReConn($_POST['reconn'] == '1'
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ }
+ $this->mungedObject->setInheritMode(isset($_POST['inherit'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ $this->mungedObject->setCtxMaxConnectionTimeF(!isset($_POST['CtxMaxConnectionTimeF'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ $this->mungedObject->setCtxMaxDisconnectionTimeF(
+ !isset($_POST['CtxMaxDisconnectionTimeF'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ $this->mungedObject->setCtxMaxIdleTimeF(!isset($_POST['CtxMaxIdleTimeF'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ $this->mungedObject->setConnectClientDrives(isset($_POST['connectclientdrives'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ $this->mungedObject->setConnectClientPrinters(isset($_POST['connectclientprinters'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+ $this->mungedObject->setDefaultPrinter(isset($_POST['defaultprinter'])
+ && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+
+ /* Save combo boxes. Takes two values */
+ if(isset($_POST['reconn'])) {
+ $this->mungedObject->setShadow(isset($_POST['shadow']) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite),$_POST['shadow']);
+ }
+
+ /* Check for changes */
+ if ($this->sambaMungedDial != $this->mungedObject->getMunged()){
+ $this->is_modified= TRUE;
+ }
+ }
+ }
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ /* Load uid and gid of this 'dn' */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cat($this->dn, array('uidNumber', 'gidNumber'));
+ $tmp= $ldap->fetch();
+ $this->uidNumber= $tmp['uidNumber'][0];
+ $this->gidNumber= $tmp['gidNumber'][0];
+
+ plugin::save();
+
+ /* Remove objectClass for sambaIdmapEntry */
+ $tmp= array();
+ for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
+ if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
+ $tmp[]= $this->attrs['objectClass'][$i];
+ }
+ }
+ $this->attrs['objectClass']= $tmp;
+
+ /* Generate rid / primaryGroupId */
+ if ($this->samba3){
+ if (!isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){
+ msg_dialog::display(_("Warning"), _("Undefined Samba SID detected. Please fix this problem manually!"), WARNING_DIALOG);
+ } else {
+ $this->SID= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'];
+ $this->ridBase= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE'];
+ }
+
+ /* Need to generate a new uniqe uid/gid combination? */
+ if ($this->sambaSID == "" || $this->orig_sambaDomainName != $this->sambaDomainName){
+ $uidNumber= $this->uidNumber;
+ while(TRUE){
+ $sid= $this->SID."-".($uidNumber*2 + $this->ridBase);
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(sambaSID=$sid)", array("sambaSID"));
+ if ($ldap->count() == 0){
+ break;
+ }
+ $uidNumber++;
+ }
+ $this->attrs['sambaSID']= $sid;
+
+ /* Check for users primary group */
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
+ if ($ldap->count() != 1){
+ msg_dialog::display(_("Warning"), _("Cannot convert primary group to samba group: group cannot be identified!"), WARNING_DIALOG);
+ } else {
+ $attrs= $ldap->fetch();
+ $g= new group($this->config, $ldap->getDN());
+ if ($g->sambaSID == ""){
+ $g->sambaDomainName= $this->sambaDomainName;
+ $g->smbgroup= TRUE;
+ $g->save ();
+ }
+ $this->attrs['sambaPrimaryGroupSID']= $g->sambaSID;
+ }
+ }
+
+ if ($this->sambaHomeDrive == ""){
+ $this->attrs["sambaHomeDrive"]= array();
+ }
+
+ /* Generate munged dial value */
+ $this->attrs["sambaMungedDial"]= $this->mungedObject->getMunged();
+
+ /* User wants me to fake the idMappings? This is useful for
+ making winbind resolve the user names in a reasonable amount
+ of time in combination with larger databases. */
+ if (isset($this->config->current['SAMBAIDMAPPING']) &&
+ preg_match('/true/i', $this->config->current['SAMBAIDMAPPING'])){
+ $this->attrs['objectClass'][]= "sambaIdmapEntry";
+ }
+
+
+ /* Password expiery */
+ if ($this->password_expires == "1"){
+ $this->attrs['sambaPwdMustChange']= $this->sambaPwdMustChange;
+ } else {
+ $this->attrs['sambaPwdMustChange']= array();
+ }
+ /* Make sure not to save zero in sambaPwdLastset */
+ if ($this->sambaPwdLastSet != "0"){
+ $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet;
+ } else {
+ $this->attrs['sambaPwdLastSet']= array();
+ }
+ /* Account expiery */
+ if ($this->logon_time_set == "1"){
+ $this->attrs['sambaLogonTime']= $this->sambaLogonTime;
+ } else {
+ $this->attrs['sambaLogonTime']= array();
+ }
+ if ($this->logoff_time_set == "1"){
+ $this->attrs['sambaLogoffTime']= $this->sambaLogoffTime;
+ } else {
+ $this->attrs['sambaLogoffTime']= array();
+ }
+ if ($this->kickoff_time_set == "1"){
+ # Add one day in unixtime format to be compatible with usrmgr
+ //$this->attrs['sambaKickoffTime']= $this->sambaKickoffTime + 86400;
+ $this->attrs['sambaKickoffTime']= $this->sambaKickoffTime; //hickert
+ } else {
+ $this->attrs['sambaKickoffTime']= array();
+ }
+ } else {
+ /* Not samba3 */
+ $this->attrs['rid']= $this->uidNumber*2 + 1000;
+ $this->attrs['primaryGroupID']= $this->gidNumber*2 +1001;
+
+ if ($this->homeDrive == ""){
+ $this->attrs["homeDrive"]= array();
+ }
+
+ /* Password expiery */
+ if ($this->password_expires == "1"){
+ $this->attrs['pwdMustChange']= $this->pwdMustChange;
+ } else {
+ $this->attrs['pwdMustChange']= 2147483647;
+ }
+ /* Make sure not to save zero in pwdLastset */
+ if ($this->pwdLastSet != "0"){
+ $this->attrs['pwdLastSet']= $this->pwdLastSet;
+ } else {
+ $this->attrs['pwdLastSet']= array();
+ }
+ /* Account expiery */
+ if ($this->logon_time_set == "1"){
+ $this->attrs['logonTime']= $this->logonTime;
+ } else {
+ $this->attrs['logonTime']= array();
+ }
+ if ($this->logoff_time_set == "1"){
+ $this->attrs['logoffTime']= $this->logoffTime;
+ } else {
+ $this->attrs['logoffTime']= array();
+ }
+ if ($this->kickoff_time_set == "1"){
+ # Add one day in unixtime format to be compatible with usrmgr
+ $this->attrs['kickoffTime']= $this->kickoffTime + 86400;
+ } else {
+ $this->attrs['kickoffTime']= array();
+ }
+ }
+
+ /* Write back to ldap */
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ if($this->initially_was_account){
+ new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/samba account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ if ($this->initially_was_account == $this->is_account){
+ if ($this->is_modified){
+ $this->handle_post_events("modify", array("uid" => $this->uid));
+ }
+ } else {
+ $this->handle_post_events("add", array("uid" => $this->uid));
+ }
+ }
+
+
+ /* Force password set, if this account doesn't have any samba passwords */
+ function password_change_needed()
+ {
+ if(!$this->initially_was_account && $this->is_account){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($this->dn,array("sambaLMPassword","sambaNTPassword"));
+ $attrs = $ldap->fetch();
+ if(!isset($attrs['sambaLMPassword']) || !isset($attrs['sambaNTPassword'])){
+ return(TRUE);
+ }
+ }
+ return(FALSE);
+ }
+
+
+ function adapt_from_template($dn)
+ {
+ plugin::adapt_from_template($dn);
+ $this->sambaSID= "";
+ $this->sambaPrimaryGroupSID= "";
+
+ /* Fill mungedDial field */
+ if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
+ $this->mungedObject->load($this->sambaMungedDial);
+ }
+
+ /* Password expiery */
+ if(isset($this->attrs['sambaPwdMustChange']) &&
+ $this->attrs['sambaPwdMustChange'][0] != 0){
+ $this->password_expires= 1;
+ }
+
+ if(isset($this->attrs['sambaLogonTime']) && ! (
+ $this->attrs['sambaLogonTime'][0] == 0 ||
+ $this->attrs['sambaLogonTime'][0] == 2147483647
+ )){
+ $this->logon_time_set= 1;
+ }
+ if(isset($this->attrs['sambaLogoffTime']) && ! (
+ $this->attrs['sambaLogoffTime'][0] == 0 ||
+ $this->attrs['sambaLogoffTime'][0] == 2147483647
+ )){
+ $this->logoff_time_set= 1;
+ }
+
+ /* Account expiery */
+ if(isset($this->attrs['sambaKickoffTime']) && ! (
+ $this->attrs['sambaKickoffTime'][0] == 0 ||
+ $this->attrs['sambaKickoffTime'][0] == 2147483647
+ )){
+ $this->kickoff_time_set= 1;
+ }
+
+ /* Get global filter config */
+ if (!session::is_set("sambafilter")){
+ $ui= get_userinfo();
+ $base= get_base_from_people($ui->dn);
+ $sambafilter= array( "depselect" => $base, "regex" => "*");
+ session::set("sambafilter", $sambafilter);
+ }
+ }
+
+
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Samba"),
+ "plDescription" => _("Samba settings"),
+ "plSelfModify" => TRUE,
+ "plDepends" => array("user"),
+ "plPriority" => 5,
+ "plSection" => array("personal" => _("My account")),
+ "plCategory" => array("users"),
+ "plOptions" => array(),
+
+ "plProvidedAcls" => array(
+ "AllowLoginOnTerminalServer" => _("Allow login on terminal server"),
+ "InheritClientConfig" => _("Inherit client config"),
+
+ "sambaPwdCanChange" => _("Allow user to change password") ,
+ "sambaAcctFlagsN" => _("Login from windows client requires no password"),
+ "sambaAcctFlagsL" => _("Lock samba account"),
+
+
+ "sambaKickoffTime" => _("Account expires") ,
+ "sambaPwdMustChange" => _("Password expires") ,
+
+ "sambaLogonTime" => _("Limit Logon Time") ,
+ "sambaLogoffTime" => _("Limit Logoff Time") ,
+ "sambaLogonHours" => _("Logon hours") ,
+
+ "sambaHomePath" => _("Generic home directory") ,
+ "sambaHomeDrive" => _("Generic samba home drive") ,
+ "sambaLogonScript" => _("Generic script path") ,
+ "sambaProfilePath" => _("Generic profile path") ,
+ "sambaDomainName" => _("Domain") ,
+ "sambaUserWorkstations" => _("Allow connection from")))
+ );
+ }
+
+ function enable_multiple_support()
+ {
+ plugin::enable_multiple_support();
+ if($this->samba3){
+ $this->multiple_support_active = TRUE;
+ }else{
+ $this->multiple_support_active = FALSE;
+ }
+ }
+
+ function multiple_save_object()
+ {
+ if (isset($_POST['sambaTab'])){
+ $this->save_object();
+ plugin::multiple_save_object();
+ foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath",
+ "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
+ "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
+ "onnectclientprinters","defaultprinter","shadow","brokenconn",
+ "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
+ "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
+ "workstation_list") as $attr){
+ if(isset($_POST["use_".$attr])){
+ $this->multi_boxes[] = $attr;
+ }
+ }
+ }
+ }
+
+
+ function multiple_check()
+ {
+ $message = plugin::multiple_check();
+
+ /* Strings */
+ foreach (array( "sambaHomePath" => _("Home directory"),
+ "sambaProfilePath" => _("Profile path")) as $key => $val){
+ if (in_array($key,$this->multi_boxes) && !$this->mungedObject->is_samba_path($this->$key)){
+ $message[]= sprintf(_("The value specified as '%s' contains invalid characters!"), $val);
+ }
+ }
+
+ /* Numeric values */
+ foreach (array( "CtxMaxConnectionTime" => _("Connection"),
+ "CtxMaxDisconnectionTime" => _("Disconnection"),
+ "CtxMaxIdleTime" => _("IDLE")) as $key => $val){
+ if (in_array($key,$this->multi_boxes) &&
+ isset($this->mungedObject->ctx[$key]) &&
+ !tests::is_id($this->mungedObject->ctx[$key]) && $val != 0){
+ $message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
+ }
+ }
+
+ /* Too many workstations? Windows usrmgr only supports eight */
+ if (substr_count($this->sambaUserWorkstations, ",") >= 8){
+ $message[]= _("The windows user manager only allows eight clients. You've specified more than eight.");
+ }
+ return($message);
+ }
+
+
+ function get_multi_init_values()
+ {
+ $ret = plugin::get_multi_init_values();
+
+ /* Parse given sambaUserWorkstations into array
+ * to allow "init_multiple_support()" to detect multiple used workstations.
+ * Those workstations will be displayed in light grey.
+ */
+ $tmp2 = array("count" => 0);
+ $tmp = split(",", $this->sambaUserWorkstations);
+ foreach($tmp as $station){
+ $station = trim($station);
+ if(!empty($station)){
+ $tmp2[] = $station;
+ $tmp2['count'] ++;
+ }
+ }
+ $ret['sambaUserWorkstations'] = $tmp2;
+ return($ret);
+ }
+
+
+
+ function init_multiple_support($attrs,$all)
+ {
+ plugin::init_multiple_support($attrs,$all);
+
+ $this->multiple_sambaUserWorkstations = array();
+ if(isset($all['sambaUserWorkstations'])){
+ for($i = 0 ; $i < $all['sambaUserWorkstations']['count'] ; $i++){
+ $station = trim($all['sambaUserWorkstations'][$i]);
+ $this->multiple_sambaUserWorkstations[$station] = array("Name" => $station, "UsedByAllUsers" => FALSE);
+ }
+ }
+ if(isset($attrs['sambaUserWorkstations'])){
+ for($i = 0 ; $i < $attrs['sambaUserWorkstations']['count'] ; $i++){
+ $station = trim($attrs['sambaUserWorkstations'][$i]);
+ $this->multiple_sambaUserWorkstations[$station] = array("Name" => $station, "UsedByAllUsers" => TRUE);
+ }
+ }
+ }
+
+ function multiple_execute()
+ {
+ return($this->execute());
+ }
+
+ function get_multi_edit_values()
+ {
+ $ret = plugin::get_multi_edit_values();
+
+ /* Terminal Server */
+ if(in_array("tslogin",$this->multi_boxes)){
+ $ret['tslogin'] = $this->mungedObject->getTsLogin();
+ }
+ if(in_array("CtxWFHomeDirDrive",$this->multi_boxes)){
+ $ret['CtxWFHomeDirDrive'] = $this->mungedObject->ctx['CtxWFHomeDirDrive'];
+ }
+ if(in_array("CtxWFHomeDir",$this->multi_boxes)){
+ $ret['CtxWFHomeDir'] = $this->mungedObject->ctx['CtxWFHomeDir'];
+ }
+ if(in_array("CtxWFProfilePath",$this->multi_boxes)){
+ $ret['CtxWFProfilePath'] = $this->mungedObject->ctx['CtxWFProfilePath'];
+ }
+
+ if(in_array("inherit",$this->multi_boxes)){
+ $ret['inherit'] = $this->mungedObject->getInheritMode();
+ }
+ if(in_array("CtxInitialProgram",$this->multi_boxes)){
+ $ret['CtxInitialProgram'] = $this->mungedObject->ctx['CtxInitialProgram'];
+ }
+ if(in_array("CtxWorkDirectory",$this->multi_boxes)){
+ $ret['CtxWorkDirectory'] = $this->mungedObject->ctx['CtxWorkDirectory'];
+ }
+
+ /* Time Limits. Be careful here, there are some negations */
+ if(in_array("CtxMaxConnectionTimeF",$this->multi_boxes)){
+ $ret["CtxMaxConnectionTimeF"] = !$this->mungedObject->getCtxMaxConnectionTimeF();
+ if(!$ret["CtxMaxConnectionTimeF"]){
+ $ret["CtxMaxConnectionTime"] = $this->mungedObject->ctx['CtxMaxConnectionTime'];
+ }
+ }
+ if(in_array("CtxMaxDisconnectionTimeF",$this->multi_boxes)){
+ $ret["CtxMaxDisconnectionTimeF"]= !$this->mungedObject->getCtxMaxDisconnectionTimeF();
+ if(!$ret["CtxMaxDisconnectionTimeF"]){
+ $ret["CtxMaxDisconnectionTime"]= $this->mungedObject->ctx['CtxMaxDisconnectionTime'];
+ }
+ }
+ if(in_array("CtxMaxIdleTimeF",$this->multi_boxes)){
+ $ret["CtxMaxIdleTimeF"] = !$this->mungedObject->getCtxMaxIdleTimeF();
+ if(!$ret["CtxMaxIdleTimeF"]){
+ $ret["CtxMaxIdleTime"] = $this->mungedObject->ctx['CtxMaxIdleTime'];
+ }
+ }
+
+ /* Client Devices */
+ if(in_array("connectclientdrives",$this->multi_boxes)){
+ $ret["connectclientdrives"] = $this->mungedObject->getConnectClientDrives();
+ }
+ if(in_array("connectclientprinters",$this->multi_boxes)){
+ $ret["connectclientprinters"] = $this->mungedObject->getConnectClientPrinters();
+ }
+ if(in_array("defaultprinter",$this->multi_boxes)){
+ $ret["defaultprinter"] = $this->mungedObject->getDefaultPrinter();
+ }
+
+ /* Misc */
+ if(in_array("shadow",$this->multi_boxes)){
+ $ret["shadow"] =$this->mungedObject->getShadow();
+ }
+ if(in_array("brokenconn",$this->multi_boxes)){
+ $ret["brokenconn"]=$this->mungedObject->getBrokenConn();
+ }
+ if(in_array("reconn",$this->multi_boxes)){
+ $ret["reconn"] =$this->mungedObject->getReConn();
+ }
+
+ /* Flags */
+ if(in_array("allow_pwchange",$this->multi_boxes)){
+ $ret['sambaPwdCanChange'] = $this->sambaPwdCanChange;
+ $ret['pwdCanChange'] = $this->pwdCanChange;
+ }
+
+ if(in_array("password_expires",$this->multi_boxes)){
+ $ret['password_expires'] = $this->password_expires;
+ $ret['sambaPwdMustChange']= $this->sambaPwdMustChange;
+ }
+ if(in_array("logon_time_set",$this->multi_boxes)){
+ $ret['logon_time_set'] = $this->logon_time_set;
+ $ret['sambaLogonTime'] = $this->sambaLogonTime;
+ }
+ if(in_array("logoff_time_set",$this->multi_boxes)){
+ $ret['logoff_time_set'] = $this->logoff_time_set;
+ $ret['sambaLogoffTime'] = $this->sambaLogoffTime;
+ }
+ if(in_array("kickoff_time_set",$this->multi_boxes)){
+ $ret['kickoff_time_set'] = $this->kickoff_time_set;
+ $ret['sambaKickoffTime'] = $this->sambaKickoffTime;
+ }
+
+ if(in_array("no_password_required",$this->multi_boxes)){
+ $ret['no_password_required'] = $this->no_password_required;
+ }
+
+ if(in_array("temporary_disable",$this->multi_boxes)){
+ $ret['temporary_disable'] = $this->temporary_disable;
+ }
+
+ if(in_array("SetSambaLogonHours",$this->multi_boxes)){
+ $ret['sambaLogonHours'] = $this->sambaLogonHours;
+ }
+
+ if(in_array("workstation_list",$this->multi_boxes)){
+ $ret['multiple_sambaUserWorkstations'] = $this->multiple_sambaUserWorkstations;
+ }
+ return($ret);
+ }
+
+ function set_multi_edit_values($values)
+ {
+ plugin::set_multi_edit_values($values);
+
+ /* Prepare current workstation settings to be merged
+ * with multiple edit settings.
+ */
+ if(isset($values['multiple_sambaUserWorkstations'])){
+ $cur_ws = array();
+ $m_ws = $values['multiple_sambaUserWorkstations'];
+
+ /* Prepare current settings to be merged */
+ if(isset($this->sambaUserWorkstations)){
+ $ttmp = split(",",$this->sambaUserWorkstations);
+ foreach($ttmp as $station){
+ $station = trim($station);
+ if(!empty($station)){
+ $cur_ws[$station] = array("Name" => $station, "UsedByAllUsers" => TRUE);
+ }
+ }
+ }
+
+ /* Unset removed workstations */
+ foreach($cur_ws as $cur_name => $cur_station){
+ if(!isset($m_ws[$cur_name])){
+ unset($cur_ws[$cur_name]);
+ }
+ }
+
+ /* Add all added workstations */
+ foreach($m_ws as $name => $station){
+ if($station['UsedByAllUsers']){
+ $cur_ws[$name] = $station;
+ }
+ }
+
+ $this->sambaUserWorkstations = "";
+ foreach($cur_ws as $name => $ws){
+ $this->sambaUserWorkstations .= $name.",";
+ }
+ $this->sambaUserWorkstations=preg_replace("/,$/","",$this->sambaUserWorkstations);
+ }
+
+ /* Enable disabled terminal login, this is inverted somehow */
+ if(isset($values['tslogin'])) $this->mungedObject->setTsLogin(!$values['tslogin']);
+
+ /* Imherit client configuration */
+ if(isset($values['inherit'])) $this->mungedObject->setInheritMode($values['inherit']);
+
+ /* Get all ctx values posted */
+ $ctx = array("CtxWFHomeDirDrive","CtxWFHomeDir","CtxWFProfilePath","CtxInitialProgram","CtxWorkDirectory",
+ "CtxMaxConnectionTime","CtxMaxDisconnectionTime","CtxMaxIdleTime");
+ foreach($ctx as $attr){
+ if(isset($values[$attr])){
+ $this->mungedObject->ctx[$attr] = $values[$attr] ;
+ }
+ }
+
+ if(isset($values['CtxMaxConnectionTimeF'])) $this->mungedObject->setCtxMaxConnectionTimeF($values['CtxMaxConnectionTimeF']);
+ if(isset($values['CtxMaxDisconnectionTimeF']))$this->mungedObject->setCtxMaxDisconnectionTimeF($values['CtxMaxDisconnectionTimeF']);
+ if(isset($values['CtxMaxIdleTimeF'])) $this->mungedObject->setCtxMaxIdleTimeF($values['CtxMaxIdleTimeF']);
+
+ if(isset($values['connectclientdrives'])) $this->mungedObject->setConnectClientDrives($values['connectclientdrives']);
+ if(isset($values['connectclientprinters'])) $this->mungedObject->setConnectClientPrinters($values['connectclientprinters']);
+ if(isset($values['defaultprinter'])) $this->mungedObject->setDefaultPrinter($values['defaultprinter']);
+
+ if(isset($values['shadow'])) $this->mungedObject->setShadow($values['shadow'],$values['shadow']);
+ if(isset($values['brokenconn'])) $this->mungedObject->setBrokenConn($values['brokenconn'],$values['brokenconn']);
+ if(isset($values['reconn'])) $this->mungedObject->setReConn($values['reconn'],$values['reconn']);
+
+
+ if(isset($values['sambaPwdCanChange'])) $this->sambaPwdCanChange = $values['sambaPwdCanChange'];
+ if(isset($values['pwdCanChange'])) $this->pwdCanChange = $values['pwdCanChange'];
+
+
+
+
+ if(isset($values['password_expires'])){
+ $this->password_expires = $values['password_expires'];
+ $this->sambaPwdMustChange = $values['sambaPwdMustChange'];
+ }
+ if(isset($values['logon_time_set'])){
+ $this->logon_time_set = $values['logon_time_set'];
+ $this->sambaLogonTime = $values['sambaLogonTime'];
+ }
+ if(isset($values['logoff_time_set'])){
+ $this->logoff_time_set = $values['logoff_time_set'];
+ $this->sambaLogoffTime = $values['sambaLogoffTime'];
+ }
+ if(isset($values['kickoff_time_set'])){
+ $this->kickoff_time_set = $values['kickoff_time_set'];
+ $this->sambaKickoffTime = $values['sambaKickoffTime'];
+ }
+
+ if(isset($values['no_password_required'])){
+ if($values['no_password_required']){
+ if(!preg_match("/N/",$this->sambaAcctFlags)) {
+ $this->sambaAcctFlags = preg_replace("/ /","N",$this->sambaAcctFlags,1);
+ }
+ }else{
+ $this->sambaAcctFlags = preg_replace("/N/"," ",$this->sambaAcctFlags,1);
+ }
+ }
+
+ if(isset($values['temporary_disable'])){
+ if($values['temporary_disable']){
+ if(preg_match("/L/",$this->sambaAcctFlags)) {
+ // Keep L
+ }else{
+ $this->sambaAcctFlags = preg_replace("/ /","D",$this->sambaAcctFlags,1);
+ }
+ }else{
+ $this->sambaAcctFlags = preg_replace("/D/"," ",$this->sambaAcctFlags,1);
+ }
+ }
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc b/gosa-plugins/samba/personal/samba/class_sambaLogonHours.inc
--- /dev/null
@@ -0,0 +1,147 @@
+<?php
+
+class sambaLogonHours extends plugin
+{
+
+ var $sambaLogonHours = "";
+ var $Matrix = array();
+ var $timezone = 0;
+ var $config;
+
+ function sambaLogonHours (&$config, $dn, $slh)
+ {
+ plugin::plugin($config,$dn);
+ $this->sambaLogonHours = $slh;
+
+ /* Get default timezone */
+ $zone = timezone::get_default_timezone();
+ $this->timezone = $zone['value'];
+
+ /* Convert to bin */
+ $tmp = '';
+ for($i = 0 ; $i < strlen($slh) ; $i ++){
+ $tmp .= str_pad(base_convert($slh[$i],16,2),4,'0',STR_PAD_LEFT);
+ }
+ $slh = $tmp;
+
+ /* Set to default if value is empty or seams to be broken */
+ if(strlen($slh) != 168){
+ $slh = str_pad('',168 , "1");
+ }
+
+ /* Rework string, because it was stored in little endian */
+ $new = '';
+ for($i = 0 ; $i < 21 ; $i ++ ){
+ $part = strrev(substr($slh, $i * 8, 8));
+ $byte['hi'] = substr($part,0,4);
+ $byte['low'] = substr($part,4,4);
+ $new .= $byte['hi'].$byte['low'];
+ }
+
+ /* Shift string to match given timezone settings */
+ $shift_by = (168 + $this->timezone) % 168;
+ for($i = 0 ; $i < $shift_by; $i ++){
+ $new = $new[167].$new;
+ $new = substr($new,0,168);
+ }
+
+ /* Create matrix */
+ $this->Matrix = array();
+ for($day = 0 ; $day < 7 ; $day ++ ){
+ for($hour = 0 ; $hour < 24 ; $hour ++){
+ $bitpos = ($day * 24 + $hour) % 168;
+ $this->Matrix[$day][$hour] = $new[$bitpos];
+ }
+ }
+ }
+
+ function execute()
+ {
+
+ $week_days = array();
+ $week_days[0]= _("Sunday");
+ $week_days[1]= _("Monday");
+ $week_days[2]= _("Tuesday");
+ $week_days[3]= _("Wednesday");
+ $week_days[4]= _("Thursday");
+ $week_days[5]= _("Friday");
+ $week_days[6]= _("Saturday");
+
+ $hours = array();
+ for($i = 0 ; $i <24 ; $i++ ){
+ $hours[$i] = $i ;
+ }
+ $ui =get_userinfo();
+
+ $smarty = get_smarty();
+ $smarty->assign("Matrix",$this->Matrix);
+ $smarty->assign("Days" ,$week_days);
+ $smarty->assign("Hours" ,$hours);
+ return($smarty->fetch(get_template_path("sambaLogonHours.tpl",TRUE,dirname(__FILE__))));
+ }
+
+ function save_object()
+ {
+ /* Get userinfo */
+ $ui = get_userinfo();
+
+ /* Check if dialog was opened and if there were any changes */
+ if(isset($_POST['sambaLogonHoursPosted'])){
+ foreach($this->Matrix as $day_key => $days){
+ foreach($days as $hour_key => $hour){
+ if(isset($_POST['day_'.$day_key.'_'.$hour_key])){
+ $this->Matrix[$day_key][$hour_key] = 1;
+ }else{
+ $this->Matrix[$day_key][$hour_key] = 0;
+ }
+ }
+ }
+ }
+ }
+
+ function save()
+ {
+
+ /* Convert Matrix to Hex */
+ $slh = "";
+ foreach($this->Matrix as $day_key => $days){
+ foreach($days as $hour_key => $hour){
+ $slh .= $hour;
+ }
+ }
+
+ /* Shift string to match given timezone settings */
+ $shift_by = (168 + ($this->timezone*(-1))) % 168;
+ for($i = 0 ; $i < $shift_by; $i ++){
+ $slh = $slh[167].$slh;
+ $slh = substr($slh,0,168);
+ }
+
+ /* Rework string, because it was stored in little endian */
+ $new = '';
+ for($i = 0 ; $i < 21 ; $i ++ ){
+ $part = strrev(substr($slh, $i * 8, 8));
+ $byte['hi'] = substr($part,0,4);
+ $byte['low'] = substr($part,4,4);
+ $new .= $byte['hi'].$byte['low'];
+ }
+
+ /* Convert to bin */
+ $tmp = '';
+ for($i = 0 ; $i < 21 ; $i ++){
+ $tmp .= str_pad(base_convert(substr($new,$i*8,8),2,16),2,'0',STR_PAD_LEFT);
+ }
+
+ /* Create uppercase HEX chars */
+ $ret = strtoupper( $tmp);
+
+ /* All hours and days selected */
+ if(substr_count($ret,'F') == 42){
+ $ret = "";
+ }
+
+ return($ret);
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/samba/personal/samba/class_sambaMungedDial.inc b/gosa-plugins/samba/personal/samba/class_sambaMungedDial.inc
--- /dev/null
@@ -0,0 +1,609 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2004 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+
+/* File header is treated as constant. It cannot be defined inside the class if $PHP_VERSION < 5 */
+define ("FILEHEADER",
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "5000");
+/* This is the old header, it is needed to automatically convert old mungedDials to new ones */
+define ("FILEHEADER_OLD",
+ "6d000800200020002000200020002000".
+ "20002000200020002000200020002000".
+ "20002000200020002000200064000100".
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "20002000200020002000200020002000".
+ "50001000");
+
+class sambaMungedDial
+{
+ /* Terminal server variables (samba3) */
+ var $ctx= array(
+ 'CtxCfgPresent' => '551e0bb0',
+ 'CtxCfgFlags1' => '00e00010',
+ 'CtxCallback' => '',
+ 'CtxShadow' => '01000000',
+ 'CtxMaxConnectionTime' => '',
+ 'CtxMaxDisconnectionTime' => '',
+ 'CtxMaxIdleTime' => '',
+ 'CtxKeyboardLayout' => '',
+ 'CtxMinEncryptionLevel' => '00',
+ 'CtxWorkDirectory' => '',
+ 'CtxNWLogonServer' => '',
+ 'CtxWFHomeDir' => '',
+ 'CtxWFHomeDirDrive' => '',
+ 'CtxWFProfilePath' => '',
+ 'CtxInitialProgram' => '',
+ 'CtxCallbackNumber' => '');
+
+ /* attribute list for save action */
+ var $ctxattributes= array("CtxCfgPresent", "CtxCfgFlags1", "CtxCallback",
+ "CtxShadow", "CtxMaxConnectionTime", "CtxMaxDisconnectionTime",
+ "CtxMaxIdleTime", "CtxKeyboardLayout", "CtxMinEncryptionLevel",
+ "CtxWorkDirectory", "CtxNWLogonServer", "CtxWFHomeDir",
+ "CtxWFHomeDirDrive", "CtxWFProfilePath", "CtxInitialProgram",
+ "CtxCallbackNumber");
+
+ /* These parameters are treated as strings and get a trailing zero */
+ var $stringParams= array( "CtxWorkDirectory", "CtxNWLogonServer",
+ "CtxWFHomeDir", "CtxWFHomeDirDrive",
+ "CtxWFProfilePath", "CtxInitialProgram", "CtxCallbackNumber");
+
+ /* These parameters are treated as time values and get converted */
+ var $timeParams= array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime");
+
+ var $old_behavior= false;
+
+ function strhex($string)
+ {
+ $hex="";
+
+ for ($i=0; $i<strlen($string); $i++) {
+ $hex.= dechex(ord($string[$i]));
+ }
+
+ return ($hex);
+ }
+
+ function hexstr($hex)
+ {
+ $string="";
+
+ for ($i=0; $i<strlen($hex)-1; $i+=2) {
+ $string.= chr(hexdec($hex[$i].$hex[$i+1]));
+ }
+
+ return ($string);
+ }
+
+ function endian($src)
+ {
+ return (substr($src, 2, 2).substr($src, 0, 2));
+ }
+
+ function genTime ($minutes)
+ {
+ $usec= (int) ($minutes * 60 * 1000);
+ $src= sprintf('%04x%04x', $usec & 0x0FFFF, ($usec & 0x0FFFF0000) >> 16);
+ return (sambaMungedDial::endian(substr($src, 0, 4)).sambaMungedDial::endian(substr($src, 4, 4)));
+ }
+
+ function readTime ($time)
+ {
+ $lo= substr($time, 0, 4);
+ $hi= substr($time, 4, 4);
+
+ $usecs= (hexdec(substr($lo, 2, 2)) * 256 + hexdec(substr($lo, 0, 2))) +
+ (hexdec(substr($hi, 2 ,2)) * 256 + hexdec(substr($hi, 0, 2))) * 256 * 256;
+
+ return ((int)($usecs / (60 * 1000)));
+ }
+
+ function to8bit($string)
+ {
+ $result= "";
+
+ /* Strip zeros */
+ for ($i= 0; $i<strlen($string); $i++){
+ if ($string[$i] != chr(0)){
+ $result.= $string[$i];
+ }
+ }
+
+ return ($result);
+ }
+
+ function is_samba_path($path)
+ {
+ if ($path == ""){
+ return (TRUE);
+ }
+
+ if (!preg_match('/^[a-z0-9%\\\\_.:+-\\\\$]+$/i', $path)){
+ return (FALSE);
+ }
+
+ return preg_match ("/\\\\.+$/", $path);
+ }
+
+ /* Encode full MungedDial-String */
+ function encode_munged ($params)
+ {
+ /* Walk through the parameters and convert them */
+ $result= sambaMungedDial::hexstr(FILEHEADER);
+
+ // CHANGED: We need to insert the number of attributes right after FILEHEADER.
+ $counter= 0;
+ $result_tmp= "";
+ foreach ($params as $paramName => $paramValue) {
+ /* String parameter? */
+ if (in_array($paramName, $this->stringParams)){
+ $isString= TRUE;
+ $paramValue= sambaMungedDial::strhex($paramValue.chr(0).chr(0));
+ } else {
+ $isString= FALSE;
+ }
+
+ /* Time parameter? */
+ if (in_array($paramName, $this->timeParams)){
+ $paramValue= sambaMungedDial::genTime($paramValue);
+ }
+
+ $result_tmp.= sambaMungedDial::munge($paramName, $paramValue, $isString);
+ $counter++;
+ }
+
+ // First add the number of attributes
+ $result.= sambaMungedDial::hexstr(sprintf("%02x00", $counter));
+
+ // Then the usual stuff
+ $result.= $result_tmp;
+
+ return ($result);
+ }
+
+ /* Setup parameter given by paramName to MungedDial-Format */
+ function munge($paramName, $paramValue, $isString)
+ {
+ $result= "";
+
+ /* Encode paramName to UTF-16 */
+ if (function_exists("recode")){
+ $utfName= recode("ISO8859-15..UTF-16", $paramName);
+ } else {
+ $utfName= iconv("ISO8859-15", "UTF-16BE", $paramName);
+ }
+
+ /* Set parameter length, high and low byte */
+ $paramLen= strlen($utfName);
+ $result.= chr($paramLen & 0x0FF);
+ $result.= chr(($paramLen & 0x0FF00) >> 8);
+
+ /* String parameters have additional trailing bytes */
+ $valueLen= strlen($paramValue);
+ $result.= chr($valueLen & 0x0FF);
+ $result.= chr(($valueLen & 0x0FF00) >> 8);
+
+ /* Length fields have a trailing '01' appended by the UTF-16 converted name */
+ $result.= chr(1);
+ $result.= $utfName;
+
+ /* Parameter is padded with '00' */
+ $result.= chr(0);
+ $result.= $paramValue;
+
+ /* Append a trailing '00' to string parameters */
+ if ($isString && (strlen($paramValue) & 1)){
+ $result.= chr(0);
+ }
+
+ return ($result);
+ }
+
+ /* Takes a base64-encoded MungedDial-String and returns an array of included parameters and values */
+ function decode_munged($munge)
+ {
+ $result= array();
+
+ /*
+ * Remove base64 encoding and skip FILEHEADER.
+ * The '4' is added, because the FILEHEADER has been stripped by 4 chars.
+ * This is the number of attributes following - we don't need this at read time, only when writing.
+ */
+ if(substr(base64_decode($munge),0,2)=="6d") {
+ $this->old_behavior=true;
+ }
+
+ $ctxField="";
+ if($this->old_behavior==true) {
+ $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER_OLD)) / 2);
+ } else {
+ $ctxField= substr(base64_decode($munge), (strlen(FILEHEADER)+4) / 2);
+ }
+
+ /* Decode parameters */
+ while ($ctxField!=""){
+
+ /* Read value lengths */
+ $ctxParmNameLength= ord($ctxField[0]) + 16 * ord($ctxField[1]);
+ $ctxParmLength= ord($ctxField[2]) + 16 * ord($ctxField[3]);
+
+ /* Reposition ctxField on start of parameter name, read parameter name */
+ $ctxField= substr($ctxField, 6);
+ $ctxParmName= sambaMungedDial::to8bit(substr($ctxField, 0, $ctxParmNameLength));
+
+ /* Reposition ctxField on start of parameter */
+ $ctxField= substr($ctxField, $ctxParmNameLength);
+ $ctxParm= substr($ctxField, 0, $ctxParmLength);
+
+ /* If string parameter, convert */
+ if (in_array($ctxParmName, $this->stringParams)){
+ $ctxParm= sambaMungedDial::hexstr($ctxParm);
+ }
+ /* If time parameter, convert */
+ if (in_array($ctxParmName, $this->timeParams)){
+ $ctxParm= sambaMungedDial::readTime($ctxParm);
+ }
+
+ /* Assign in result array */
+ $result[$ctxParmName]= trim($ctxParm);
+
+ /* Reposition ctxField on end of parameter and continue */
+ $ctxField= substr($ctxField, $ctxParmLength);
+ }
+
+ return ($result);
+ }
+
+ /* function takes a base64-encoded sambaMungedDial */
+ function load ($mungedDial)
+ {
+ $this->ctx= $this->decode_munged($mungedDial);
+ }
+
+ /* Returns ready-to-run mungedDialString to be filled into ldap */
+ function getMunged ()
+ {
+ // Do extra check for valid timeParams (they must be set to 0 if disabled)
+ foreach($this->timeParams as $value) {
+ if(!isset($this->ctx[$value])) {
+ $this->ctx[$value]= 0;
+ }
+ }
+ $result= base64_encode($this->encode_munged($this->ctx));
+
+ return $result;
+ }
+
+ /* Returns array of flags, which can be set on-demand with activated java-script */
+ function getOnDemandFlags ()
+ {
+ $result= array();
+ if (session::get("js")){
+ foreach ($this->timeParams as $value) {
+ if (!isset($this->ctx[$value]) || (isset($this->ctx[$value]) && $this->ctx[$value] == 0)) {
+ $result[$value."Mode"]= "disabled";
+ } else {
+ $result[$value."Mode"]= "";
+ }
+ }
+
+ if (substr($this->ctx['CtxCfgFlags1'], 6, 1) == "1") {
+ $result['CtxInitialProgramMode'] = "disabled";
+ } else {
+ $result['CtxInitialProgramMode'] = "";
+ }
+ }else{
+ foreach ($this->timeParams as $value) {
+ $result[$value."Mode"]= "";
+ }
+
+ $result['CtxInitialProgramMode'] = "";
+
+ }
+
+ return $result;
+ }
+
+ /*Gets Terminal-Server-Login value: enabled/disabled */
+ function getTsLogin ()
+ {
+ $flags= ord(substr($this->ctx['CtxCfgFlags1'], 5, 1));
+
+ if ($flags & 1) {
+ $result= false;
+ } else {
+ $result= true;
+ }
+
+ return $result;
+ }
+
+ /* Sets Terminal-Server-Login value: enabled/disabled */
+ function setTsLogin ($checked)
+ {
+ $flag= substr($this->ctx['CtxCfgFlags1'], 5, 1);
+
+ if ($checked) {
+ $flag|= 1;
+ } else {
+ $flag&= 0xFE;
+ }
+
+ $this->ctx['CtxCfgFlags1'][5]= sprintf('%1x', $flag);
+ }
+
+ /* gets Broken-Connection value: disconnect/reset */
+ function getBrokenConn ()
+ {
+ $flags= ord(substr($this->ctx['CtxCfgFlags1'], 5, 1));
+ if ($flags & 4) {
+ $result= "1";
+ } else {
+ $result= "0";
+ }
+
+ return $result;
+ }
+
+ /* sets Broken-Connection value: disconnect/reset */
+ function setBrokenConn ($checked)
+ {
+ $flag= substr($this->ctx['CtxCfgFlags1'], 5, 1);
+
+ if ($checked) {
+ $flag|= 4;
+ } else {
+ $flag&= 0xFB;
+ }
+
+ $this->ctx['CtxCfgFlags1'][5]= sprintf('%1x', $flag);
+ }
+
+ /* gets Reconnection value: from any client/from previous client only */
+ function getReConn ()
+ {
+ $flags= ord(substr($this->ctx['CtxCfgFlags1'], 5, 1));
+ if ($flags & 2) {
+ $result= "1";
+ } else {
+ $result= "0";
+ }
+
+ return $result;
+ }
+
+ /* sets Reconnection value: from any client/from previous client only */
+ function setReConn ($checked)
+ {
+ $flag= substr($this->ctx['CtxCfgFlags1'], 5, 1);
+
+ if ($checked) {
+ $flag|= 2;
+ } else {
+ $flag&= 0xFD;
+ }
+
+ $this->ctx['CtxCfgFlags1'][5]= sprintf('%1x', $flag);
+ }
+
+ /* gets Inherit-config-from-client value: enabled/disabled */
+ function getInheritMode ()
+ {
+ if (substr($this->ctx['CtxCfgFlags1'], 6, 1) == "1") {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* sets Inherit-config-from-client value: enabled/disabled */
+ function setInheritMode ($checked)
+ {
+ if ($checked) {
+ $this->ctx['CtxCfgFlags1'][6]= "1";
+ } else {
+ $this->ctx['CtxCfgFlags1'][6]= "0";
+ }
+ }
+
+ /* gets shadow value (enum): 0-4
+ 0: disabled
+ 1: input on, notify on
+ 2: input on, notify off
+ 3: input off, notify on
+ 4: input off, notify off
+ */
+ function getShadow ()
+ {
+ if($this->old_behavior==true) {
+ $result= substr($this->ctx['CtxCfgFlags1'], 1, 1);
+ } else {
+ $result= substr($this->ctx['CtxShadow'], 1, 1);
+ }
+ return $result;
+ }
+
+ /* sets shadow value */
+ function setShadow ($checked, $value)
+ {
+ if ($checked) {
+ if($this->old_behavior==true) {
+ // We need to reset the old setting
+ $this->ctx['CtxCfgFlags1'][1]= sprintf('%1X', $value);
+ }
+ $this->ctx['CtxShadow'][1]= sprintf('%1x', $value);
+ }
+ }
+
+ /* gets connect-client-drive-at-logon value: enabled/disabled */
+ function getConnectClientDrives ()
+ {
+ $connections= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
+ if ($connections & 8) {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* sets connect-client-drive-at-logon value: enabled/disabled */
+ function setConnectClientDrives ($checked)
+ {
+ $flag= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
+ if ($checked) {
+ $flag|= 8;
+ } else {
+ $flag&= 0xF7;
+ }
+
+ $this->ctx['CtxCfgFlags1'][2]= sprintf('%1x', $flag);
+ }
+
+ /* gets connect-client-printers-at-logon value: enabled/disabled */
+ function getConnectClientPrinters ()
+ {
+ $connections= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
+ if ($connections & 4) {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* sets connect-client-printers-at-logon value: enabled/disabled */
+ function setConnectClientPrinters ($checked)
+ {
+ $flag= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
+
+ if ($checked) {
+ $flag|= 4;
+ } else {
+ $flag&= 0xFB;
+ }
+
+ $this->ctx['CtxCfgFlags1'][2]= sprintf('%1x', $flag);
+ }
+
+ /* gets set-client-printer-to-default value: enabled/disabled */
+ function getDefaultPrinter ()
+ {
+ $connections= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
+ if ($connections & 2) {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* sets set-client-printer-to-default value: enabled/disabled */
+ function setDefaultPrinter ($checked)
+ {
+ $flag= hexdec(substr($this->ctx['CtxCfgFlags1'], 2, 1));
+
+ if ($checked) {
+ $flag|= 2;
+ } else {
+ $flag&= 0xFD;
+ }
+
+ $this->ctx['CtxCfgFlags1'][2]= sprintf('%1x', $flag);
+ }
+
+ /* SMARTY: gets the checkbox state of "Connection" */
+ function getCtxMaxConnectionTimeF ()
+ {
+ // Connection Time is 0 if disabled
+ if (isset($this->ctx['CtxMaxConnectionTime']) && ($this->ctx['CtxMaxConnectionTime'] != 0)) {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* SMARTY: sets the checkbox "Connection" to unchecked */
+ function setCtxMaxConnectionTimeF ($checked)
+ {
+ if ($checked) {
+ unset ($this->ctx['CtxMaxConnectionTime']);
+ }
+ }
+
+ /* SMARTY: gets the checkbox state of "Disconnection" */
+ function getCtxMaxDisconnectionTimeF ()
+ {
+ // Connection Time is 0 if disabled
+ if (isset($this->ctx['CtxMaxDisconnectionTime']) && ($this->ctx['CtxMaxDisconnectionTime'] != 0)) {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* SMARTY: sets the checkbox "Disconnection" to unchecked */
+ function setCtxMaxDisconnectionTimeF ($checked)
+ {
+ if ($checked) {
+ unset ($this->ctx['CtxMaxDisconnectionTime']);
+ }
+ }
+
+ /* SMARTY: gets the checkbox state of "Idle" */
+ function getCtxMaxIdleTimeF ()
+ {
+ // Connection Time is 0 if disabled
+ if (isset($this->ctx['CtxMaxIdleTime']) && ($this->ctx['CtxMaxIdleTime'] != 0)) {
+ $result= true;
+ } else {
+ $result= false;
+ }
+
+ return $result;
+ }
+
+ /* SMARTY: sets the checkbox "Idle" to unchecked */
+ function setCtxMaxIdleTimeF ($checked)
+ {
+ if ($checked) {
+ unset ($this->ctx['CtxMaxIdleTime']);
+ }
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/samba/personal/samba/main.inc b/gosa-plugins/samba/personal/samba/main.inc
--- /dev/null
@@ -0,0 +1,131 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2003 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+$display = "";
+$lock_msg = "";
+if (!$remove_lock){
+ /* Reset requested? */
+ if (isset($_POST['edit_cancel']) ||
+ (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+ del_lock ($ui->dn);
+ session::un_set ('edit');
+ session::un_set ('sambaAccount');
+ }
+
+ /* Create sambaAccount object on demand */
+ if (!session::is_set('sambaAccount') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $sambaAccount= new sambaAccount ($config, $ui->dn);
+ $sambaAccount->enable_CSN_check();
+ $sambaAccount->set_acl_base($ui->dn);
+ $sambaAccount->set_acl_category("users");
+ session::set('sambaAccount',$sambaAccount);
+ }
+ $sambaAccount = session::get('sambaAccount');
+
+ /* save changes back to object */
+ if (session::is_set('edit')){
+ $sambaAccount->save_object ();
+ }
+
+ /* Enter edit mode? */
+ if (isset($_POST['edit'])){
+
+ /* Check locking */
+ if (($username= get_lock($ui->dn)) != ""){
+ session::set('back_plugin',$plug);
+ session::set('LOCK_VARS_TO_USE',array("/^edit$/","/^plug$/"));
+ $lock_msg = gen_locked_message ($username, $ui->dn);
+
+ }else{
+
+ /* Lock the current entry */
+ add_lock ($ui->dn, $ui->dn);
+ session::set('dn',$ui->dn);
+ session::set('edit',TRUE);
+ }
+ }
+
+ /* save changes to LDAP and disable edit mode */
+ if (isset($_POST['edit_finish'])){
+
+ /* Perform checks */
+ $message= $sambaAccount->check ();
+
+ /* No errors, save object */
+ if (count ($message) == 0){
+ $sambaAccount->save ();
+ del_lock ($ui->dn);
+ session::un_set ('edit');
+
+ /* Remove from session */
+ session::un_set ('sambaAccount');
+ } else {
+ /* Errors found, show message */
+ show_errors ($message);
+ }
+ }
+
+ /* Execute formular */
+ if($lock_msg){
+ $display.= $lock_msg;
+ }else{
+ $display.= $sambaAccount->execute ();
+ }
+
+ /* Store changes in session */
+ if (session::is_set('edit')){
+ session::set('sambaAccount',$sambaAccount);
+ }
+
+ $info= "";
+ if (($sambaAccount->is_account) && (!$sambaAccount->show_ws_dialog) && empty($lock_msg)){
+ $display.= "<p class=\"plugbottom\">";
+
+ /* Are we in edit mode? */
+ if (session::is_set('edit')){
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+ $display.= " ";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+ "\"> ".$ui->dn." ";
+ } else {
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+ "\"> ".$ui->dn." ";
+
+ if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/sambaAccount"))){
+
+ $info.= "<img 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=\"edit\" value=\""._("Edit")."\">\n";
+ }
+ $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+ }
+ $display.= "</p>\n";
+ }
+
+ /* Page header*/
+ $display= print_header(get_template_path('images/samba.png'), _("Samba settings"),
+ $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/samba/personal/samba/samba2.tpl b/gosa-plugins/samba/personal/samba/samba2.tpl
--- /dev/null
@@ -0,0 +1,116 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+
+ <!-- Headline container -->
+ <tr>
+ <td colspan="2" style="width:50%; vertical-align:top;">
+ <h2><p class="center"><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</p></h2>
+ </td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td><label for="smbHome">{t}Samba home{/t}</label></td>
+ <td>
+
+{render acl=$smbHomeACL}
+ <input id="smbHome" name="smbHome" size=30 maxlength=60 value="{$smbHome}">
+{/render}
+
+{render acl=$smbDriveACL}
+ <select size="1" name="homeDrive">
+ <option disabled> </option>
+ {html_options values=$drives output=$drives selected=$homeDrive}
+ </select>
+{/render}
+
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td><label for="scriptPath">{t}Script path{/t}</label></td>
+ <td>
+{render acl=$scriptPathACL}
+ <input id="scriptPath" name="scriptPath" size=35 maxlength=60 value="{$scriptPath}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="profilePath">{t}Profile path{/t}</label></td>
+ <td>
+{render acl=$profilePathACL}
+ <input id="profilePath" name="profilePath" size=35 maxlength=60 value="{$profilePath}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+<p class="seperator"> </p>
+
+<h2><p class="center"><img class="center" alt="" align="middle" src="images/certs.png" /> {t}Access options{/t}</p></h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+ <tr>
+ <td style="width:50%;">
+{render acl=$allow_pwchangeACL}
+ <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP}>
+{/render}
+ <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
+ <br>
+{render acl=$no_password_requiredACL}
+ <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN}>
+{/render}
+ <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
+ <br>
+{render acl=$temporary_disableACL}
+ <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD}>
+{/render}
+ <label for="temporary_disable">{t}Temporary disable samba account{/t}</label>
+ <br>
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top; width:50%">
+{render acl=$password_expiresACL}
+ <input type=checkbox name="password_expires" value="1" {$flagsC}>
+{/render}
+ <label for="day">{t}Password expires on{/t}</label>
+{render acl=$sambaPwdMustChangeACL}
+ <select id="day" name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
+ {html_options values=$days output=$days selected=$day}
+ </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+ <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
+ {html_options options=$months selected=$month}
+ </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+ <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
+ {html_options values=$years output=$years selected=$year}
+ </select>
+{/render}
+ <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
+ </td>
+ </tr>
+</table>
+
+<input type="hidden" name="sambaTab" value="sambaTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+ <!--
+ // Populate expiery dialog
+ populate(document.mainform,document.mainform.sambaPwdMustChange);
+ -->
+</script>
diff --git a/gosa-plugins/samba/personal/samba/samba3.tpl b/gosa-plugins/samba/personal/samba/samba3.tpl
--- /dev/null
@@ -0,0 +1,470 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+
+ <!-- Headline container -->
+ <tr>
+ <td colspan="2" style="width:50%; vertical-align:top;">
+ <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"/> {t}Generic{/t}</h2>
+ </td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td><label for="sambaHomePath">{t}Home directory{/t}</label></td>
+ <td>
+{render acl=$sambaHomePathACL checkbox=$multiple_support checked=$use_sambaHomePath}
+ <input id="sambaHomePath" name="sambaHomePath" size=30 maxlength=60 value="{$sambaHomePath}">
+{/render}
+{render acl=$sambaHomeDriveACL checkbox=$multiple_support checked=$use_sambaHomeDrive}
+ <select size="1" name="sambaHomeDrive">
+ <option disabled> </option>
+ {html_options values=$drives output=$drives selected=$sambaHomeDrive}
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="sambaDomainName">{t}Domain{/t}</label></td>
+ <td>
+{render acl=$sambaDomainNameACL checkbox=$multiple_support checked=$use_sambaDomainName}
+ <select id="sambaDomainName" size="1" name="sambaDomainName">
+ {html_options values=$domains output=$domains selected=$sambaDomainName}
+ </select>
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td><label for="">{t}Script path{/t}</label></td>
+ <td>
+{render acl=$sambaLogonScriptACL checkbox=$multiple_support checked=$use_sambaLogonScript}
+ <input id="sambaLogonScript" name="sambaLogonScript" size=35 maxlength=60 value="{$sambaLogonScript}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="">{t}Profile path{/t}</label></td>
+ <td>
+{render acl=$sambaProfilePathACL checkbox=$multiple_support checked=$use_sambaProfilePath}
+ <input class="center" id="sambaProfilePath" name="sambaProfilePath" size=35 maxlength=60 value="{$sambaProfilePath}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+<p class="seperator"> </p>
+
+<h2><img class="center" alt="" align="middle" src="images/display.png" /> {t}Terminal Server{/t}</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+ <td style="vertical-align:top;width:50%">
+
+{if $multiple_support}
+ <input class="center" type=checkbox name="use_tslogin" id="use_tslogin" value="1"
+ {if $use_tslogin} checked {/if}
+ onClick="changeState('tslogin')">
+ <input class="center" type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin}
+ {if !$use_tslogin} disabled {/if}>
+{else}
+{render acl=$AllowLoginOnTerminalServerACL}
+ <input class="center" type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin}
+ onclick="
+ changeState('CtxWFHomeDir');
+ changeState('CtxWFHomeDirDrive');
+ changeState('CtxWFProfilePath');
+ changeState('inherit');
+ changeTripleSelectState_2nd_neg('tslogin','inherit','CtxInitialProgram');
+ changeTripleSelectState_2nd_neg('tslogin','inherit','CtxWorkDirectory');
+ changeState('CtxMaxConnectionTimeF');
+ changeState('CtxMaxDisconnectionTimeF');
+ changeState('CtxMaxIdleTimeF');
+ changeTripleSelectState('tslogin','CtxMaxConnectionTimeF','CtxMaxConnectionTime');
+ changeTripleSelectState('tslogin','CtxMaxDisconnectionTimeF','CtxMaxDisconnectionTime');
+ changeTripleSelectState('tslogin','CtxMaxIdleTimeF','CtxMaxIdleTime');
+ changeState('connectclientdrives');
+ changeState('connectclientprinters');
+ changeState('defaultprinter');
+ changeState('shadow');
+ changeState('brokenconn');
+ changeState('reconn');
+ ">
+{/render}
+{/if}
+ <i>{t}Allow login on terminal server{/t}</i>
+ <table summary="">
+ <tr>
+ <td><label for="CtxWFHomeDir">{t}Home directory{/t}</label></td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFHomeDir}
+ <input id="CtxWFHomeDir" name="CtxWFHomeDir" size=30 maxlength=60 value="{$CtxWFHomeDir}" {$tsloginstate}>
+{/render}
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFHomeDirDrive}
+ <select size="1" id="CtxWFHomeDirDrive" name="CtxWFHomeDirDrive" {$tsloginstate}>
+ <option disabled> </option>
+ {html_options values=$drives output=$drives selected=$CtxWFHomeDirDrive}
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="CtxWFProfilePath">{t}Profile path{/t}</label></td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFProfilePath}
+ <input id="CtxWFProfilePath" name="CtxWFProfilePath" size=35 maxlength=60 value="{$CtxWFProfilePath}" {$tsloginstate}>
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;">
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_inherit}
+ <input class="center" type=checkbox id="inherit" name="inherit" {if $inheritstate} checked {/if}
+ onClick="changeState('CtxInitialProgram');
+ changeState('CtxWorkDirectory');"
+
+ >
+{/render}
+ <i>{t}Inherit client config{/t}</i>
+ <table summary="">
+ <tr>
+ <td><label for="CtxInitialProgram">{t}Initial program{/t}</label></td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxInitialProgram}
+ <input id="CtxInitialProgram" name="CtxInitialProgram" size=35 maxlength=60 value="{$CtxInitialProgram}" {$inheritstate}>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="CtxWorkDirectory">{t}Working directory{/t}</label></td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWorkDirectory}
+ <input id="CtxWorkDirectory" name="CtxWorkDirectory" size=35 maxlength=60 value='{$CtxWorkDirectory}' {$inheritstate}>
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+<p class="seperator"> </p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+ <td style="vertical-align:top;">
+ <i>{t}Timeout settings (in minutes){/t}</i>
+ <table summary="">
+ <tr>
+ <td>
+{if $multiple_support}
+<input type="checkbox" name="use_CtxMaxConnectionTimeF" {if $use_CtxMaxConnectionTimeF} checked {/if}
+ onClick="changeState('CtxMaxConnectionTimeF');" class="center"
+ >
+{/if}
+{render acl=$AllowLoginOnTerminalServerACL}
+ <input id="CtxMaxConnectionTimeF" type="checkbox" class="center" name="CtxMaxConnectionTimeF"
+ {if !$use_CtxMaxConnectionTimeF && $multiple_support} disabled {/if}
+ value="1" {$CtxMaxConnectionTimeF}
+ onclick="changeState('CtxMaxConnectionTime')" {$tsloginstate}>
+{/render}
+
+ <label for="CtxMaxConnectionTimeF">{t}Connection{/t}</label>
+ </td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+ <input name="CtxMaxConnectionTime" id="CtxMaxConnectionTime" size=5 maxlength=5 value="{$CtxMaxConnectionTime}" {$tsloginstate}
+ { if !$CtxMaxConnectionTimeF } disabled {/if}>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxMaxDisconnectionTimeF}
+ <input id="CtxMaxDisconnectionTimeF" type=checkbox name="CtxMaxDisconnectionTimeF" value="1" {$CtxMaxDisconnectionTimeF} onclick="changeState('CtxMaxDisconnectionTime')" {$tsloginstate} class="center">
+{/render}
+ <label for="CtxMaxDisconnectionTimeF">{t}Disconnection{/t}</label>
+ </td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+ <input name="CtxMaxDisconnectionTime" id="CtxMaxDisconnectionTime" size=5 maxlength=5 value="{$CtxMaxDisconnectionTime}" {$tsloginstate}
+ { if !$CtxMaxDisconnectionTimeF } disabled {/if}>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxMaxIdleTimeF}
+ <input id="CtxMaxIdleTimeF" type=checkbox name="CtxMaxIdleTimeF" value="1" {$CtxMaxIdleTimeF} onclick="changeState('CtxMaxIdleTime')" {$tsloginstate} class="center">
+{/render}
+ <label for="CtxMaxIdleTimeF">{t}IDLE{/t}</label>
+ </td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+ <input name="CtxMaxIdleTime" id="CtxMaxIdleTime" size=5 maxlength=5 value="{$CtxMaxIdleTime}" {$tsloginstate}
+ { if !$CtxMaxIdleTimeF } disabled {/if}>
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;">
+
+ <i>{t}Client devices{/t}</i>
+ <table summary="">
+ <tr>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_connectclientdrives}
+ <input id="connectclientdrives" type=checkbox name="connectclientdrives" value="1" {$connectclientdrives} {$tsloginstate} class="center">
+{/render}
+ <label for="connectclientdrives">{t}Connect client drives at logon{/t}</label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_connectclientprinters}
+ <input id="connectclientprinters" type=checkbox name="connectclientprinters" value="1" {$connectclientprinters}{$tsloginstate} class="center">
+{/render}
+ <label for="connectclientprinters">{t}Connect client printers at logon{/t}</label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_defaultprinter}
+ <input id="defaultprinter" type=checkbox name="defaultprinter" value="1" {$defaultprinter} {$tsloginstate} class="center">
+{/render}
+ <label for="defaultprinter">{t}Default to main client printer{/t}</label>
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;width:50%">
+ <i>{t}Miscellaneous{/t}</i>
+ <table summary="">
+ <tr>
+ <td>
+ <label for="shadow">{t}Shadowing{/t}</label>
+ </td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_shadow}
+ <select id="shadow" size="1" name="shadow" >
+ {html_options options=$shadow selected=$shadowmode}
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="brokenconn">{t}On broken or timed out{/t}</label></td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_brokenconn}
+ <select id="brokenconn" size="1" name="brokenconn">
+ {html_options options=$brokenconn selected=$brokenconnmode}
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><label for="reconn">{t}Reconnect if disconnected{/t}</label></td>
+ <td>
+{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_reconn}
+ <select id="reconn" size="1" name="reconn">
+ {html_options options=$reconn selected=$reconnmode}
+ </select>
+{/render}
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+</table>
+
+<p class="seperator"> </p>
+
+<h2><img class="center" alt="" align="middle" src="images/certs.png" /> {t}Access options{/t}</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+ <td style="width:50%; vertical-align:top;">
+{render acl=$sambaPwdCanChangeACL checkbox=$multiple_support checked=$use_allow_pwchange}
+ <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP} class="center">
+{/render}
+ <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
+ <br>
+{render acl=$sambaAcctFlagsNACL checkbox=$multiple_support checked=$use_no_password_required}
+ <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN} class="center">
+{/render}
+ <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
+ <br>
+{render acl=$sambaAcctFlagsLACL checkbox=$multiple_support checked=$use_temporary_disable}
+ <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD} class="center">
+{/render}
+ <label for="temporary_disable">{t}Lock samba account{/t}</label>
+ <br>
+{render acl=$sambaPwdMustChangeACL checkbox=$multiple_support checked=$use_password_expires}
+ <input id="password_expires" type=checkbox name="password_expires" value="1" {$flagsC} class="center">
+{/render}
+ <label for="password_expires">{t}Password expires on{/t}</label>
+{render acl=$sambaPwdMustChangeACL}
+ <select name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
+ {html_options values=$days output=$days selected=$day}
+ </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+ <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
+ {html_options options=$months selected=$month}
+ </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+ <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
+ {html_options values=$years output=$years selected=$year}
+ </select>
+{/render}
+ <br>
+{render acl=$sambaLogonTimeACL checkbox=$multiple_support checked=$use_logon_time_set}
+ <input id="logon_time_set" type=checkbox name="logon_time_set" value="1" {$flagsT} class="center">
+{/render}
+ <label for="logon_time_set">{t}Limit Logon Time{/t}</label>
+{render acl=$sambaLogonTimeACL}
+ <select name=sambaLogonTime_day onChange="createResult_sambaLogonTime(this.form,this.form.sambaLogonTime);">
+ {html_options values=$sambaLogonTime_days output=$sambaLogonTime_days selected=$sambaLogonTime_day}
+ </select>
+{/render}
+{render acl=$sambaLogonTimeACL}
+ <select name=sambaLogonTime_month onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
+ {html_options options=$sambaLogonTime_months output=$sambaLogonTime_months selected=$sambaLogonTime_month}
+ </select>
+{/render}
+{render acl=$sambaLogonTimeACL}
+ <select name=sambaLogonTime_year onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
+ {html_options values=$sambaLogonTime_years output=$sambaLogonTime_years selected=$sambaLogonTime_year}
+ </select>
+{/render}
+ <br>
+{render acl=$sambaLogoffTimeACL checkbox=$multiple_support checked=$use_logoff_time_set}
+ <input id="logoff_time_set" type=checkbox name="logoff_time_set" value="1" {$flagsO} class="center">
+{/render}
+ <label for="logoff_time_set">{t}Limit Logoff Time{/t}</label>
+{render acl=$sambaLogoffTimeACL}
+ <select name=sambaLogoffTime_day onChange="createResult_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
+ {html_options values=$sambaLogoffTime_days output=$sambaLogoffTime_days selected=$sambaLogoffTime_day}
+ </select>
+{/render}
+{render acl=$sambaLogoffTimeACL}
+ <select name=sambaLogoffTime_month onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
+ {html_options options=$sambaLogoffTime_months output=$sambaLogoffTime_months selected=$sambaLogoffTime_month}
+ </select>
+{/render}
+{render acl=$sambaLogoffTimeACL}
+ <select name=sambaLogoffTime_year onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
+ {html_options values=$sambaLogoffTime_years output=$sambaLogoffTime_years selected=$sambaLogoffTime_year}
+ </select>
+{/render}
+ <br>
+
+{render acl=$sambaKickoffTimeACL checkbox=$multiple_support checked=$use_kickoff_time_set}
+ <input id="kickoff_time_set" type=checkbox name="kickoff_time_set" value="1" {$flagsK} class="center">
+{/render}
+ <label for="kickoff_time_set">{t}Account expires after{/t}</label>
+{render acl=$sambaKickoffTimeACL}
+ <select name=sambaKickoffTime_day onChange="createResult_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
+ {html_options values=$sambaKickoffTime_days output=$sambaKickoffTime_days selected=$sambaKickoffTime_day}
+ </select>
+{/render}
+{render acl=$sambaKickoffTimeACL}
+ <select name=sambaKickoffTime_month onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
+ {html_options options=$sambaKickoffTime_months output=$sambaKickoffTime_months selected=$sambaKickoffTime_month}
+ </select>
+{/render}
+{render acl=$sambaKickoffTimeACL}
+ <select name=sambaKickoffTime_year onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
+ {html_options values=$sambaKickoffTime_years output=$sambaKickoffTime_years selected=$sambaKickoffTime_year}
+ </select>
+{/render}
+ <br>
+ <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
+ <input type="hidden" name="sambaLogonTime" value="{$sambaLogonTime}">
+ <input type="hidden" name="sambaLogoffTime" value="{$sambaLogoffTime}">
+ <input type="hidden" name="sambaKickoffTime" value="{$sambaKickoffTime}">
+<br>
+{render acl=$sambaLogonHoursACL mode=read_active checkbox=$multiple_support checked=$use_SetSambaLogonHours}
+ {t}Samba logon times{/t} <input type='submit' name='SetSambaLogonHours' value='{t}Edit settings...{/t}'>
+{/render}
+
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;">
+ <label for="workstation_list">{t}Allow connection from these workstations only{/t}</label>
+ <br>
+
+{if $multiple_support}
+ <input type="checkbox" name="use_workstation_list" {if $use_workstation_list} checked {/if} class="center"
+ onClick="changeState('workstation_list');">
+ <select {if $multiple_support && !$use_workstation_list} disabled {/if}
+ id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
+
+ {foreach from=$multiple_workstations item=item key=key}
+ {if $item.UsedByAllUsers}
+ <option value="{$key}">{$item.Name} ({t}Used by all users{/t})</option>
+ {else}
+ <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;'
+ value="{$key}">{$item.Name} ({t}Used by some users{/t})</option>
+ {/if}
+ {/foreach}
+ </select>
+ <br>
+ <input type="submit" value="{t}Add{/t}" name="add_ws">
+ <input type="submit" value="{t}Delete{/t}" name="delete_ws">
+{else}
+ {render acl=$sambaUserWorkstationsACL}
+ <select id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
+ {html_options values=$workstations output=$workstations}
+ </select>
+ {/render}
+ <br>
+ {render acl=$sambaUserWorkstationsACL}
+ <input type="submit" value="{t}Add{/t}" name="add_ws">
+ {/render}
+ {render acl=$sambaUserWorkstationsACL}
+ <input type="submit" value="{t}Delete{/t}" name="delete_ws">
+ {/render}
+{/if}
+ </td>
+ </tr>
+</table>
+
+<input type="hidden" name="sambaTab" value="sambaTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+ <!--
+ // Populate expiery dialog
+ populate(document.mainform,document.mainform.sambaPwdMustChange);
+
+ // Populate samba Time dialogs
+ populate_sambaLogonTime(document.mainform,document.mainform.sambaLogonTime);
+ populate_sambaLogoffTime(document.mainform,document.mainform.sambaLogoffTime);
+ populate_sambaKickoffTime(document.mainform,document.mainform.sambaKickoffTime);
+ -->
+</script>
diff --git a/gosa-plugins/samba/personal/samba/samba3_workstations.tpl b/gosa-plugins/samba/personal/samba/samba3_workstations.tpl
--- /dev/null
@@ -0,0 +1,42 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4">
+<tr>
+ <td style="vertical-align:top;width:600px">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px">
+ <b><label for="wslist">{t}Select workstations to add{/t}</label> {$hint}</b><br />
+ </p>
+ </div>
+ <div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <select id="wslist" style="width:600px; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
+ {html_options values=$wslist output=$wslist}
+ </select>
+ </p>
+ </div>
+ </td>
+ <td style="vertical-align:top;">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]">
+ <b>{t}Filters{/t}</b></p>
+ </div>
+ <div class="contentboxb">
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ {$alphabet}
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td><img class="center" alt="{t}Display workstations of department{/t}" src="{$tree_image}" align="middle">
+ <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+ {html_options options=$deplist selected=$depselect}
+ </select></td></tr></table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="18"><img class="center" alt="" src="{$search_image}" align="middle"> </td>
+ <td><input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
+ {$apply}
+ </div>
+ </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="add_ws_finish" value="{t}Add{/t}">
+
+ <input type=submit name="add_ws_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/gosa-plugins/samba/personal/samba/sambaLogonHours.tpl b/gosa-plugins/samba/personal/samba/sambaLogonHours.tpl
--- /dev/null
@@ -0,0 +1,101 @@
+
+<!-- Javacript function used to switch a complete row or col of selected hours -->
+<script language="javascript" type="text/javascript">
+ {literal}
+ var $regex = new Array();
+ function toggle_chk($reg)
+ {
+ if(!$regex[$reg]){
+ $regex[$reg] =1;
+ }
+ $regex[$reg] *= -1;
+ if($regex[$reg] == 1){
+ chk_set_all($reg,true);
+ }else{
+ chk_set_all($reg,false);
+ }
+ }
+ {/literal}
+</script>
+
+<h1>{t}Specify the hours this user is allowed to log in{/t}</h1>
+<br>
+
+<table cellspacing=0 cellpadding=0 style='border: solid 1px #B0B0B0; background-color: #EEEEEE; width :100%;' >
+ <tr>
+ <td> </td>
+ <td colspan=24 style='text-align:center;height:24px;border-bottom: solid 1px #B0B0B0;'><b>{t}Hour{/t}</b></td>
+ </tr>
+ <tr>
+ <td style='text-align: left;' class='list0'> </td>
+ {foreach from=$Hours item=hours key=key_hours}
+ {if (($hours)%2) == 0 }
+ <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
+ {else}
+ <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0;">
+ {/if}
+ {$hours}
+ </td>
+ {/foreach}
+ </tr>
+
+ <!-- Add toggle buttons for hours -->
+ <tr>
+ <td style='text-align: left;' class='list0'>
+
+ </td>
+ {foreach from=$Hours item=hours key=key_hours}
+ {if (($hours)%2) == 0 }
+ <td style="text-align:center; height: 22px; background-color: rgb(226, 226, 226); text-align: right;">
+ {else}
+ <td style="text-align:center; height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0; text-align: right;">
+ {/if}
+
+ <input type='button' onClick="toggle_chk('^day_[0-9]*_{$hours}$');" value='+/-' style='width:100%;'>
+ </td>
+ {/foreach}
+ <td>
+
+ <input type='button' onClick="toggle_chk('^day_[0-9]*_[0-9]*$');" value='+/-' style='width:100%;'>
+ </td>
+ </tr>
+
+ <!-- Add Entries -->
+{foreach from=$Matrix item=days key=key_day}
+ <tr>
+ <td class='list0'>
+ <b>{$Days[$key_day]}</b>
+ </td>
+ {foreach from=$days item=hours key=key_hour}
+ {if (($key_hour)%2) == 0 }
+ <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
+ {else}
+ <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px;">
+ {/if}
+ {if $Matrix[$key_day].$key_hour}
+ <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' checked >
+ {else}
+ <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' >
+ {/if}
+ </td>
+ {/foreach}
+
+ <!-- Add toggle button for days -->
+ <td>
+ <input type='button' onClick="toggle_chk('^day_{$key_day}_[0-9]*$')" value='+/-' style='padding:0px;margin:0px;'>
+ </td>
+ </tr>
+{/foreach}
+</table>
+<br>
+<input type='hidden' name='sambaLogonHoursPosted' value='1'>
+<br>
+<p class="plugbottom">
+ <input type=submit name="save_logonHours" value="{t}Apply{/t}">
+
+ <input type=submit name="cancel_logonHours" value="{t}Cancel{/t}">
+</p>
+
+<!--
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->