X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Ffunctions.inc;h=d5338a003c203fb266ec38686f8a28cbbc940e1c;hb=3a308e40188042fb56365af23190514a85621963;hp=70121687e1a4d9ef95fd426af3422cbf79324006;hpb=75a4eeca94a2188fc0fba0e350040708f0b0c66e;p=gosa.git diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 70121687e..d5338a003 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -88,6 +88,7 @@ define ("DEBUG_CONFIG", 64); define ("DEBUG_ACL", 128); define ("DEBUG_SI", 256); define ("DEBUG_MAIL", 512); // mailAccounts, imap, sieve etc. +define ("DEBUG_FAI", 1024); // FAI (incomplete) /* Rewrite german 'umlauts' and spanish 'accents' to get better results */ @@ -660,9 +661,6 @@ function del_lock ($object) { global $config; - echo "$object
"; - print_a(debug_backtrace()); - if(is_array($object)){ foreach($object as $obj){ del_lock($obj); @@ -1069,7 +1067,7 @@ function eval_sizelimit() isset($_POST['action']) && $_POST['action']=="newlimit"){ session::global_set('size_limit', validate($_POST['new_limit'])); - session::global_set('size_ignore', FALSE); + session::set('size_ignore', FALSE); } /* User wants no limits? */ @@ -1101,8 +1099,8 @@ function getMenuCache() $str.= chr($e+$n); if(isset($_GET[$str])){ - if(session::global_is_set('maxC')){ - $b= session::global_get('maxC'); + if(session::is_set('maxC')){ + $b= session::get('maxC'); $q= ""; for ($m=0, $l= strlen($b);$m<$l;$m++) { $q.= $b[$m++]; @@ -1167,6 +1165,7 @@ function get_ou($name) global $config; $map = array( + "roleRDN" => "ou=roles,", "ogroupRDN" => "ou=groups,", "applicationRDN" => "ou=apps,", "systemRDN" => "ou=systems,", @@ -1290,13 +1289,14 @@ function gen_locked_message($user, $dn, $allow_readonly = FALSE) { global $plug, $config; + session::set('dn', $dn); $remove= false; /* Save variables from LOCK_VARS_TO_USE in session - for further editing */ - if( session::global_is_set('LOCK_VARS_TO_USE') && count(session::global_get('LOCK_VARS_TO_USE'))){ + if( session::is_set('LOCK_VARS_TO_USE') && count(session::get('LOCK_VARS_TO_USE'))){ $LOCK_VARS_USED = array(); - $LOCK_VARS_TO_USE = session::global_get('LOCK_VARS_TO_USE'); + $LOCK_VARS_TO_USE = session::get('LOCK_VARS_TO_USE'); foreach($LOCK_VARS_TO_USE as $name){ @@ -1316,8 +1316,8 @@ function gen_locked_message($user, $dn, $allow_readonly = FALSE) } } } - session::global_set('LOCK_VARS_TO_USE',array()); - session::global_set('LOCK_VARS_USED' , $LOCK_VARS_USED); + session::set('LOCK_VARS_TO_USE',array()); + session::set('LOCK_VARS_USED' , $LOCK_VARS_USED); } /* Prepare and show template */ @@ -1751,7 +1751,8 @@ function gen_uids($rule, $attributes) /* Don't assign used ones */ if (!in_array($uid, $used)){ - $ret[]= $uid; + /* Add uid, but remove {} first. These are invalid anyway. */ + $ret[]= preg_replace('/[{}]/', '', $uid); } } @@ -1982,40 +1983,7 @@ function compare_revision($revision_file, $revision) function progressbar($percentage,$width=100,$height=15,$showvalue=false) { - $str = ""; // Our return value will be saved in this var - - $color = dechex($percentage+150); - $color2 = dechex(150 - $percentage); - $bgcolor= $showvalue?"FFFFFF":"DDDDDD"; - - $progress = (int)(($percentage /100)*$width); - - /* If theres a better solution for this, use it... */ - $str = "\n
"; - - $str.= "\n
"; - - if(($height >10)&&($showvalue)){ - $str.= "\n "; - $str.= "\n ".$percentage."% "; - $str.= "\n "; - } - - $str.= "\n
"; - $str.= "\n
"; - $str.= "\n
"; - $str.= "\n
"; - - return($str); + return(""); } @@ -2456,7 +2424,7 @@ function change_password ($dn, $password, $mode=0, $hash= "") // Get all available encryption Methods // NON STATIC CALL :) - $methods = new passwordMethod(session::global_get('config')); + $methods = new passwordMethod(session::get('config')); $available = $methods->get_available_methods(); // read current password entry for $dn, to detect the encryption Method @@ -2576,6 +2544,11 @@ function generate_smb_nt_hash($password) } else { $hash= ""; } + + if ($hash == "") { + msg_dialog::display(_("Configuration error"), _("Cannot generate samba hash!"), ERROR_DIALOG); + return (""); + } } else { $tmp= $config->get_cfg_value('sambaHashHook')." ".escapeshellarg($password); @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute"); @@ -2584,11 +2557,11 @@ function generate_smb_nt_hash($password) flush(); reset($ar); $hash= current($ar); - } - if ($hash == "") { - msg_dialog::display(_("Configuration error"), _("Cannot generate samba hash!"), ERROR_DIALOG); - return (""); + if ($hash == "") { + msg_dialog::display(_("Configuration error"), sprintf(_("Cannot generate samba hash: running '%s' failed, check the 'sambaHashHook'!"),$config->get_cfg_value('sambaHashHook')), ERROR_DIALOG); + return (""); + } } list($lm,$nt)= split (":", trim($hash)); @@ -2810,6 +2783,16 @@ function cred_decrypt($input,$password) { return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", $input), MCRYPT_MODE_ECB, $iv); } +function get_object_info() +{ + return(session::get('objectinfo')); +} + +function set_object_info($str = "") +{ + session::set('objectinfo',$str); +} + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>