diff --git a/contrib/smarty/plugins/function.msgPool.php b/contrib/smarty/plugins/function.msgPool.php index 717942f11f9054f6bd69e7e35423eb67d4ab60ef..69945cc6ab1473592479755e94d9ee614c534665 100644 --- a/contrib/smarty/plugins/function.msgPool.php +++ b/contrib/smarty/plugins/function.msgPool.php @@ -20,20 +20,20 @@ */ function smarty_function_msgPool($params, &$smarty) { - if(class_available("msgPool") && isset($params['type'])){ - $parameter = array(); - foreach($params as $para => $value){ - if(!preg_match("/^type$/i",$para)){ - $parameter[$para] = $value; - } - } - if(is_callable("msgPool::".$params['type'])){ - echo call_user_func_array(array("msgPool",$params['type']), $parameter); - }else{ - trigger_error("Unknown msgPool function ".$params['type']); - } - }else{ - trigger_error("Unknown class msgPool."); - } + if (class_available('msgPool') && isset($params['type'])) { + $parameter = array(); + foreach ($params as $para => $value) { + if (!preg_match('/^type$/i', $para)) { + $parameter[$para] = $value; + } + } + if (is_callable('msgPool::'.$params['type'])) { + echo call_user_func_array(array('msgPool',$params['type']), $parameter); + } else { + trigger_error('Unknown msgPool function '.$params['type']); + } + } else { + trigger_error('Unknown class msgPool.'); + } } ?> diff --git a/include/password-methods/class_password-methods-sha.inc b/include/password-methods/class_password-methods-sha.inc index ef46e5b3dd7b8ccf51dd6cbaffe03dc0e250bd01..95f3dd3d6e5567a6380312d3fd19e37d4b46ffba 100644 --- a/include/password-methods/class_password-methods-sha.inc +++ b/include/password-methods/class_password-methods-sha.inc @@ -45,13 +45,7 @@ class passwordMethodsha extends passwordMethod */ function is_available() { - if (function_exists('sha1')) { - return TRUE; - } elseif (function_exists('mhash')) { - return TRUE; - } else { - return FALSE; - } + return (function_exists('sha1') || function_exists('mhash')); } /*! @@ -62,11 +56,11 @@ class passwordMethodsha extends passwordMethod function generate_hash($password) { if (function_exists('sha1')) { - $hash = "{SHA}" . base64_encode(pack("H*", sha1($password))); + $hash = '{SHA}' . base64_encode(pack('H*', sha1($password))); } elseif (function_exists('mhash')) { - $hash = "{SHA}" . base64_encode(mHash(MHASH_SHA1, $password)); + $hash = '{SHA}' . base64_encode(mHash(MHASH_SHA1, $password)); } else { - msg_dialog::display(_("Configuration error"), msgPool::missingext("mhash"), ERROR_DIALOG); + msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG); return FALSE; } @@ -78,7 +72,7 @@ class passwordMethodsha extends passwordMethod */ static function get_hash_name() { - return "sha"; + return 'sha'; } } ?> diff --git a/include/password-methods/class_password-methods-ssha.inc b/include/password-methods/class_password-methods-ssha.inc index 0108c9d1a4f562c7e123acbddddcefefbec0fd28..fa386d7aacf82f5beda9bb6a372d58c9c6504ebc 100644 --- a/include/password-methods/class_password-methods-ssha.inc +++ b/include/password-methods/class_password-methods-ssha.inc @@ -45,13 +45,7 @@ class passwordMethodssha extends passwordMethod */ function is_available() { - if (function_exists("sha1")) { - return TRUE; - } elseif (function_exists("mhash")) { - return TRUE; - } else { - return FALSE; - } + return (function_exists('sha1') || function_exists('mhash')); } /*! @@ -61,16 +55,16 @@ class passwordMethodssha extends passwordMethod */ function generate_hash($pwd) { - if (function_exists("sha1")) { - $salt = substr(pack("h*", md5(mt_rand())), 0, 8); - $salt = substr(pack("H*", sha1($salt.$pwd)), 0, 4); - $pwd = "{SSHA}".base64_encode(pack("H*", sha1($pwd.$salt)).$salt); + if (function_exists('sha1')) { + $salt = substr(pack('h*', md5(mt_rand())), 0, 8); + $salt = substr(pack('H*', sha1($salt.$pwd)), 0, 4); + $pwd = '{SSHA}'.base64_encode(pack('H*', sha1($pwd.$salt)).$salt); return $pwd; - } elseif (function_exists("mhash")) { - $salt = mhash_keygen_s2k(MHASH_SHA1, $pwd, substr(pack("h*", md5(mt_rand())), 0, 8), 4); - $pwd = "{SSHA}".base64_encode(mhash(MHASH_SHA1, $pwd.$salt).$salt); + } elseif (function_exists('mhash')) { + $salt = mhash_keygen_s2k(MHASH_SHA1, $pwd, substr(pack('h*', md5(mt_rand())), 0, 8), 4); + $pwd = '{SSHA}'.base64_encode(mhash(MHASH_SHA1, $pwd.$salt).$salt); } else { - msg_dialog::display(_("Configuration error"), msgPool::missingext("mhash"), ERROR_DIALOG); + msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG); return FALSE; } return $pwd; @@ -81,12 +75,12 @@ class passwordMethodssha extends passwordMethod $hash = base64_decode(substr($hash, 6)); $salt = substr($hash, 20); $hash = substr($hash, 0, 20); - if (function_exists("sha1")) { - $nhash = pack("H*", sha1($pwd . $salt)); - } elseif (function_exists("mhash")) { + if (function_exists('sha1')) { + $nhash = pack('H*', sha1($pwd . $salt)); + } elseif (function_exists('mhash')) { $nhash = mhash(MHASH_SHA1, $pwd.$salt); } else { - msg_dialog::display(_("Configuration error"), msgPool::missingext("mhash"), ERROR_DIALOG); + msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG); return FALSE; } return ($nhash == $hash); @@ -97,7 +91,7 @@ class passwordMethodssha extends passwordMethod */ static function get_hash_name() { - return "ssha"; + return 'ssha'; } } ?> diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 171c6b47eb42c18c4a62f6e8b0e2f4bc5b996ba7..f25766237ef962025da00c2ad39879fddfec6f68 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -920,21 +920,12 @@ class simplePlugin extends plugin $infos = pluglist::pluginInfos($tabclass); foreach ($infos['plForeignRefs'] as $field => $refs) { if (preg_match('/^handle_/', $mode)) { - if ($newdn !== NULL) { - // Move action - if (($field != 'dn') && ($mode == 'handle_move')) { - // We only change dn - continue; - } - } elseif ($olddn === NULL) { - // Edit action - if ($field == 'dn') { - // dn did not change - continue; - } elseif (!$this->attributeHaveChanged($field)) { - // only look at changed attributes - continue; - } + if (($newdn !== NULL) && ($field != 'dn') && ($mode == 'handle_move')) { + // Move action, ignore other fields than dn + continue; + } elseif (($newdn === NULL) && ($olddn === NULL) && (($field == 'dn') || (!$this->attributeHaveChanged($field)))) { + // Edit action, ignore dn changes or attributes which did not change + continue; } // else = delete action, all fields are concerned, nothing to do here }