summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f865c41)
raw | patch | inline | side by side (parent: f865c41)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 20 Sep 2007 07:03:54 +0000 (07:03 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 20 Sep 2007 07:03:54 +0000 (07:03 +0000) |
Moved functions to function.inc
Removed require_once from class passwordMethod and replaced it with $class_mapping
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7342 594d385d-05f5-0310-b6e9-bd551577e9d8
Removed require_once from class passwordMethod and replaced it with $class_mapping
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7342 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/html/include/focus.js b/html/include/focus.js
index 3f832476f01a8aa053991af8b7c134c9f59fc9d2..a5452beb620353c7c3fcda4f464b65c993c3e2fb 100644 (file)
--- a/html/include/focus.js
+++ b/html/include/focus.js
if(document.getElementById('current_msg_dialogs')){
var cur_id = document.getElementById('current_msg_dialogs').value;
if(cur_id != ""){
+ var ele = document.getElementById('e_layer2' + cur_id);
+ ele.onmousemove = "";
hide('e_layer2' + cur_id);
document.getElementById('closed_msg_dialogs').value += "," + cur_id;
document.getElementById('current_msg_dialogs').value= "";
ele.style.display= 'block' ;
document.getElementById('pending_msg_dialogs').value= tmp;
document.getElementById('current_msg_dialogs').value= i_id;
-
+ ele.onmousedown = start_move_div_by_cursor;
+ ele.onmouseup = stop_move_div_by_cursor;
+ ele.onmousemove = move_div_by_cursor;
}
}
}
}
+var enable_move_div_by_cursor = false;
+function start_move_div_by_cursor()
+{
+ enable_move_div_by_cursor = true;
+}
+function stop_move_div_by_cursor()
+{
+ enable_move_div_by_cursor = false;
+}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+function move_div_by_cursor(e)
+{
+ if(enable_move_div_by_cursor){
+ if(document.getElementById('current_msg_dialogs')){
+ var cur_id = document.getElementById('current_msg_dialogs').value;
+ if(cur_id != ""){
+ var ele = document.getElementById('e_layer2' + cur_id);
+ ele.style.position = "absolute";
+ ele.style.top = (e.screenY - 100) + "px";
+ ele.style.left = (e.screenX -50)+ "px";
+ }
+ }
+ }
+}
// vim:ts=2:syntax
diff --git a/html/password.php b/html/password.php
index 29e1edbf22b789a39b134a025a0d442bc33ef6bb..d04b92aa07720910f4576e4d8289ba3bb4c359cd 100644 (file)
--- a/html/password.php
+++ b/html/password.php
if (isset($_GET['method'])){
$method= validate($_GET['method']);
$tmp = new passwordMethod($config);
- $available = $tmp->get_available_methods_if_not_loaded();
+ $available = $tmp->get_available_methods();
if (!isset($available[$method])){
echo _("Error: Password method not available!");
exit;
index 85246df893b2608eba427fe880d349d9b8b5bf11..586a7b594429752422a07208f670df6818cd05a2 100644 (file)
{else}
<div id='e_layer2{$i_ID}'
style='display:none;'
+ onClick="move_div_by_cursor('e_layer2{$i_ID}');"
>
<!-- style="
position: absolute;
index 2cae6f815473459add5684f1a393be24a352bfbb..810f9723ecb9b0a89b0f858ceb54ce370c40a157 100644 (file)
"mimetypeManagement" => "plugins/admin/mimetypes/class_mimetypeManagement.inc",
"divListMimeTypes" => "plugins/admin/mimetypes/class_divListMimeTypes.inc",
);
-?>
\ No newline at end of file
+?>
index 3942ef0771eebfee13cd22c58c3cab527bd61060..2f7db9525d18a74c91c82ed2b4c5618b8ef0e8a7 100644 (file)
// this function returns all loaded classes for password encryption
static function get_available_methods()
{
+ global $class_mapping;
$ret =false;
- $all = get_declared_classes();
- $i = 0;
- foreach($all as $one) {
- if(preg_match('/passwordMethod/i', $one) && !preg_match("/^passwordMethod$/i", $one)){
- $name = preg_replace ("/passwordMethod/i", "", $one);
- $test = new $one(false);
+ $i =0;
+ foreach($class_mapping as $class => $path) {
+ if(preg_match('/passwordMethod/i', $class) && !preg_match("/^passwordMethod$/i", $class)){
+ $name = preg_replace ("/passwordMethod/i", "", $class);
+ $test = new $class(false);
if($test->is_available()) {
- $plugname= strtolower(preg_replace ("/passwordMethod/i","",$one));
+ $plugname= strtolower(preg_replace ("/passwordMethod/i","",$class));
$ret['name'][$i]= $plugname;
- $ret['class'][$i]=$one;
+ $ret['class'][$i]=$class;
$ret[$i]['name']= $plugname;
- $ret[$i]['class']= $one;
- $ret[$plugname]=$one;
+ $ret[$i]['class']= $class;
+ $ret[$plugname]=$class;
$i++;
}
}
}
return($ret);
}
-
-}
-
-// change_password, changes the Password, of the given dn
-function change_password ($dn, $password, $mode=0, $hash= "")
-{
- global $config;
- $newpass= "";
-
- /* Convert to lower. Methods are lowercase */
- $hash= strtolower($hash);
-
- // Get all available encryption Methods
-
- // NON STATIC CALL :)
- $tmp = new passwordMethod($_SESSION['config']);
- $available = $tmp->get_available_methods();
-
- // read current password entry for $dn, to detect the encryption Method
- $ldap = $config->get_ldap_link();
- $ldap->cat ($dn, array("shadowLastChange", "userPassword", "uid"));
- $attrs = $ldap->fetch ();
-
- // Check if user account was deactivated, indicated by ! after } ... {crypt}!###
- if(isset($attrs['userPassword'][0]) && preg_match("/^[^\}]*+\}!/",$attrs['userPassword'][0])){
- $deactivated = TRUE;
- }else{
- $deactivated = FALSE;
- }
-
-# // Get current password hash method if available
-# if($hash == "" && isset($attrs['userPassword'][0]) && preg_match("/[\{\}]/",$attrs['userPassword'][0])){
-# $hash = preg_replace("/^[^\{]*+\{([^\}]*).*$/","\\1",$attrs['userPassword'][0]);
-# $hash = strtolower($hash);
-# }
-
-# // Set encryption type to clear if required
-# if (!isset($attrs['userPassword'][0]) || $hash == ""){
-# $hash= "clear";
-# }
-
- // Detect the encryption Method
- if ( (isset($attrs['userPassword'][0]) && preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0], $matches)) || $hash != ""){
-
- /* Check for supported algorithm */
- mt_srand((double) microtime()*1000000);
-
- /* Extract used hash */
- if ($hash == ""){
- $hash= strtolower($matches[1]);
- }
-
-
- // Crypt with the detected Method
- $test = new $available[$hash]($config);
- $test->attrs= $attrs;
- $newpass = $test->generate_hash($password);
-
- } else {
- // Crypt it by default
- $test = new $available['md5']($config);
- $newpass = $test->generate_hash($password);
- }
-
- // Update shadow timestamp?
- if (isset($attrs["shadowLastChange"][0])){
- $shadow= (int)(date("U") / 86400);
- } else {
- $shadow= 0;
- }
-
- // Write back modified entry
- $ldap->cd($dn);
- $attrs= array();
-
- // Not for groups
- if ($mode == 0){
-
- if ($shadow != 0){
- $attrs['shadowLastChange']= $shadow;
- }
-
- // Create SMB Password
- $attrs= generate_smb_nt_hash($password);
- }
-
- /* Readd ! if user was deactivated */
- if($deactivated){
- $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass);
- }
-
- $attrs['userPassword']= array();
- $attrs['userPassword']= $newpass;
-
- $ldap->modify($attrs);
-
- new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error());
-
- if ($ldap->error != 'Success') {
- print_red(sprintf(_("Setting the password failed. LDAP server says '%s'."),
- $ldap->get_error()));
- } else {
-
- /* Find postmodify entries for this class */
- $command= search_config($config->data['MENU'], "password", "POSTMODIFY");
-
- if ($command != ""){
- /* Walk through attribute list */
- $command= preg_replace("/%userPassword/", $password, $command);
- $command= preg_replace("/%dn/", $dn, $command);
-
- if (check_command($command)){
- @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
- exec($command);
- } else {
- $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
- print_red ($message);
- }
- }
- }
}
-
-
-// Return something like array['sambaLMPassword']= "lalla..."
-function generate_smb_nt_hash($password)
-{
- global $config;
- $tmp= $config->data['MAIN']['SMBHASH']." ".escapeshellarg($password);
- @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
-
- exec($tmp, $ar);
- flush();
- reset($ar);
- $hash= current($ar);
- if ($hash == "")
- {
- print_red (_("Setting for SMBHASH in gosa.conf is incorrect! Can't change Samba password."));
- }
- else
- {
- list($lm,$nt)= split (":", trim($hash));
-
- if ($config->current['SAMBAVERSION'] == 3)
- {
- $attrs['sambaLMPassword']= $lm;
- $attrs['sambaNTPassword']= $nt;
- $attrs['sambaPwdLastSet']= date('U');
- $attrs['sambaBadPasswordCount']= "0";
- $attrs['sambaBadPasswordTime']= "0";
- } else {
- $attrs['lmPassword']= $lm;
- $attrs['ntPassword']= $nt;
- $attrs['pwdLastSet']= date('U');
- }
- return($attrs);
- }
-}
-
-function crypt_single($string,$enc_type )
-{
- return( passwordMethod::crypt_single_str($string,$enc_type));
-}
-
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/include/functions.inc b/include/functions.inc
index b774cb57c677bbd36466a61bc8297fae47037dad..e5944cdbb4851e43a5840b819a4cd31756bf5098 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
return(FALSE);
}
+// change_password, changes the Password, of the given dn
+function change_password ($dn, $password, $mode=0, $hash= "")
+{
+ global $config;
+ $newpass= "";
+
+ /* Convert to lower. Methods are lowercase */
+ $hash= strtolower($hash);
+
+ // Get all available encryption Methods
+
+ // NON STATIC CALL :)
+ $tmp = new passwordMethod($_SESSION['config']);
+ $available = $tmp->get_available_methods();
+
+ // read current password entry for $dn, to detect the encryption Method
+ $ldap = $config->get_ldap_link();
+ $ldap->cat ($dn, array("shadowLastChange", "userPassword", "uid"));
+ $attrs = $ldap->fetch ();
+
+ // Check if user account was deactivated, indicated by ! after } ... {crypt}!###
+ if(isset($attrs['userPassword'][0]) && preg_match("/^[^\}]*+\}!/",$attrs['userPassword'][0])){
+ $deactivated = TRUE;
+ }else{
+ $deactivated = FALSE;
+ }
+
+# // Get current password hash method if available
+# if($hash == "" && isset($attrs['userPassword'][0]) && preg_match("/[\{\}]/",$attrs['userPassword'][0])){
+# $hash = preg_replace("/^[^\{]*+\{([^\}]*).*$/","\\1",$attrs['userPassword'][0]);
+# $hash = strtolower($hash);
+# }
+
+# // Set encryption type to clear if required
+# if (!isset($attrs['userPassword'][0]) || $hash == ""){
+# $hash= "clear";
+# }
+ // Detect the encryption Method
+ if ( (isset($attrs['userPassword'][0]) && preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0], $matches)) || $hash != ""){
+
+ /* Check for supported algorithm */
+ mt_srand((double) microtime()*1000000);
+
+ /* Extract used hash */
+ if ($hash == ""){
+ $hash= strtolower($matches[1]);
+ }
+
+ $test = new $available[$hash]($config);
+ $test->attrs= $attrs;
+ $newpass = $test->generate_hash($password);
+
+ } else {
+ // Crypt it by default
+ $test = new $available['md5']($config);
+ $newpass = $test->generate_hash($password);
+ }
+
+ // Update shadow timestamp?
+ if (isset($attrs["shadowLastChange"][0])){
+ $shadow= (int)(date("U") / 86400);
+ } else {
+ $shadow= 0;
+ }
+
+ // Write back modified entry
+ $ldap->cd($dn);
+ $attrs= array();
+
+ // Not for groups
+ if ($mode == 0){
+
+ if ($shadow != 0){
+ $attrs['shadowLastChange']= $shadow;
+ }
+
+ // Create SMB Password
+ $attrs= generate_smb_nt_hash($password);
+ }
+
+ /* Readd ! if user was deactivated */
+ if($deactivated){
+ $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass);
+ }
+
+ $attrs['userPassword']= array();
+ $attrs['userPassword']= $newpass;
+
+ $ldap->modify($attrs);
+
+ new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error());
+
+ if ($ldap->error != 'Success') {
+ print_red(sprintf(_("Setting the password failed. LDAP server says '%s'."),
+ $ldap->get_error()));
+ } else {
+
+ /* Find postmodify entries for this class */
+ $command= search_config($config->data['MENU'], "password", "POSTMODIFY");
+
+ if ($command != ""){
+ /* Walk through attribute list */
+ $command= preg_replace("/%userPassword/", $password, $command);
+ $command= preg_replace("/%dn/", $dn, $command);
+
+ if (check_command($command)){
+ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+ exec($command);
+ } else {
+ $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
+ print_red ($message);
+ }
+ }
+ }
+}
+// Return something like array['sambaLMPassword']= "lalla..."
+function generate_smb_nt_hash($password)
+{
+ global $config;
+ $tmp= $config->data['MAIN']['SMBHASH']." ".escapeshellarg($password);
+ @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
+
+ exec($tmp, $ar);
+ flush();
+ reset($ar);
+ $hash= current($ar);
+ if ($hash == "")
+ {
+ print_red (_("Setting for SMBHASH in gosa.conf is incorrect! Can't change Samba password."));
+ }
+ else
+ {
+ list($lm,$nt)= split (":", trim($hash));
+
+ if ($config->current['SAMBAVERSION'] == 3)
+ {
+ $attrs['sambaLMPassword']= $lm;
+ $attrs['sambaNTPassword']= $nt;
+ $attrs['sambaPwdLastSet']= date('U');
+ $attrs['sambaBadPasswordCount']= "0";
+ $attrs['sambaBadPasswordTime']= "0";
+ } else {
+ $attrs['lmPassword']= $lm;
+ $attrs['ntPassword']= $nt;
+ $attrs['pwdLastSet']= date('U');
+ }
+ return($attrs);
+ }
+}
+
+function crypt_single($string,$enc_type )
+{
+ return( passwordMethod::crypt_single_str($string,$enc_type));
+}
+
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc
index 9d3e07510eeaf0b4806ed8bd505625a08f85efa0..b97f6e65b57392711ea968affe3eec9547927b1e 100644 (file)
"gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox","gosaMailAlternateAddress","gosaVacationStart","gosaVacationStop",
"gosaVacationMessage", "gosaMailAlternateAddress", "gosaMailForwardingAddress");
var $objectclasses= array("gosaMailAccount");
- var $uid;
+ var $uid = "";
var $sieve_management = NULL;
/* Set mailMethod to the one defined in gosa.conf */
if (isset($this->config->current['MAILMETHOD'])){
$method= $this->config->current['MAILMETHOD'];
- if (isset($class_mapping["mailMethod$method"])){
+
+ $cls = get_correct_class_name("mailMethod$method");
+ if ($cls && class_exists($cls)){
$this->method= "mailMethod$method";
} else {
print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $method));
index a1e9c0b6b664a08867b5d44f883cb68a26c0d648..71289795430413cee6843706178893f32040ed15 100644 (file)
{
$this->update_strings();
- $tmp = @passwordMethod::get_available_methods_if_not_loaded();
+ $tmp = @passwordMethod::get_available_methods();
foreach($tmp['name'] as $name){
$this->crypt_methods[$name] = $name;
}
index 42db9f8bb4d84d090ed07a419e787af6fa1fa826..6e4d85f7ea6cc4c9f863bfd78c6efa872d269169 100644 (file)
$dn = "uid=".$uid.",".$people_ou.$cv['base'];
}
- $methods = @passwordMethod::get_available_methods_if_not_loaded();
+ $methods = @passwordMethod::get_available_methods();
$p_m = $methods[$cv['encryption']];
$p_c = new $p_m(array());
$hash = $p_c->generate_hash($pw2);