summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc81c08)
raw | patch | inline | side by side (parent: cc81c08)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 22 Mar 2011 06:30:51 +0000 (06:30 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 22 Mar 2011 06:30:51 +0000 (06:30 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20628 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_core.inc | patch | blob | history | |
gosa-core/include/functions.inc | patch | blob | history |
index 919d887ea990cf4e8c6dee4d807afdbc2c3740ad..9fb3846549c5b419279877abacb8c3fb5a25785a 100644 (file)
"check" => "",
"migrate" => "",
"group" => "snapshot",
- "mandatory" => FALSE)
+ "mandatory" => FALSE),
+ array(
+ "name" => "forceTranslit",
+ "type" => "bool",
+ "default" => "false",
+ "description" => _("Force to use internal translate function (fix for generation of uid for cyrillic sn and givenName)."),
+ "check" => "gosaProperty::isBool",
+ "migrate" => "",
+ "group" => "core",
+ "mandatory" => TRUE)
)));
}
}
index 1e13afa0f5aa69aff239b79828deca83c415b0e4..a04310fe66f2c1164c16d1d91fe92aa1cb1b9ef6 100644 (file)
"ñ" => "ny",
"Ñ" => "Ny" );
+/*! \brief Cyrillic (russian) fonetic transliteration (converts russian letters to ASCII and backward according to GOST 7.79-2000 )
+ * \param string 'str' Source string in russian codepage
+ * \return string Translitered string value.
+ */
+function cyrillic2ascii($str) {
+ $ru = array('а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я',
+ 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'H', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я',
+ 'ґ', 'є', 'ї', 'Ґ', 'Є', 'Ї'
+ );
+ $en = array('a', 'b', 'v', 'g', 'd', 'e', 'jo','zh','z', 'i', 'jj','k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'kh','c', 'ch','sh','shh','"', 'y', '\'','eh','ju','ja',
+ 'A', 'B', 'V', 'G', 'D', 'E', 'Jo','Je','Z', 'I', 'Jj','K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'Kh','C', 'CH','SH','Shh','"', 'Y', '\'','Eh','Ju','Ja',
+ 'g', 'ye','yi','G', 'Ye','Yi'
+ );
+
+ return str_replace($ru, $en, $str);
+}
+
/*! \brief Does autoloading for classes used in GOsa.
*
}
-/*! \brief Debug level action
+/*! \brief DEBUG level action
*
- * Print a DEBUG level if specified debug level of the level matches the
+ * print a DEBUG level if specified debug level of the level matches the
* the configured debug level.
*
* \param int 'level' The log level of the message (should use the constants,
$ldap = $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
-
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $rule, "Processing");
+
// Strip out non ascii chars
foreach($attributes as $name => $value){
- $value = iconv('UTF-8', 'US-ASCII//TRANSLIT', $value);
+ if ( $config->get_cfg_value("core", "forceTranslit") == "true" ) {
+ $value = cyrillic2ascii($value);
+ } else {
+ $value = iconv('UTF-8', 'US-ASCII//TRANSLIT', $value);
+ }
$value = preg_replace('/[^(\x20-\x7F)]*/','',$value);
$attributes[$name] = strtolower($value);
}
+
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $attributes, "Prepare");
// Search for '{%...[n-m]}
// Get all matching parts of the given string and sort them by
// Create proposal array
$rules = array($rule);
foreach($replacements as $tag => $values){
- $rules = gen_uid_proposals($rules, $tag,$values);
+ $rules = gen_uid_proposals($rules, $tag, $values);
}
// Search for id tags {id:3} / {id#3}
- preg_match_all('/\{id(#|:)([0-9])+\}/i', $rule ,$matches, PREG_SET_ORDER);
+ preg_match_all('/\{id(#|:)([0-9])+\}/i', $rule, $matches, PREG_SET_ORDER);
$idReplacements = array();
foreach($matches as $match){
if(count($match) != 3) continue;