64 if ( $sOxId !=
"-1" && isset( $sOxId)) {
68 return "language_main.tpl";
86 if ( !isset( $aParams[
'active'])) {
87 $aParams[
'active'] = 0;
90 if ( !isset( $aParams[
'default'])) {
91 $aParams[
'default'] =
false;
94 if ( empty( $aParams[
'sort'])) {
95 $aParams[
'sort'] =
'99999';
105 $blViewError =
false;
108 if ( $sOxId != -1 && $sOxId != $aParams[
'abbr'] ) {
110 if ( (
int) $this->_aLangData[
'params'][$sOxId][
'baseId'] == 0 ) {
111 $oEx =
oxNew(
"oxExceptionToDisplay" );
112 $oEx->setMessage(
'LANGUAGE_ABBRCHANGEMAINLANG_WARNING' );
114 $aParams[
'abbr'] = $sOxId;
117 $sOxId = $aParams[
'abbr'];
125 if ( $blNewLanguage = ($sOxId == -1) ) {
126 $sOxId = $aParams[
'abbr'];
132 $this->_aLangData[
'lang'][$sOxId] = $aParams[
'desc'];
135 $this->_aLangData[
'params'][$sOxId][
'active'] = $aParams[
'active'];
136 $this->_aLangData[
'params'][$sOxId][
'default'] = $aParams[
'default'];
137 $this->_aLangData[
'params'][$sOxId][
'sort'] = $aParams[
'sort'];
140 if ( $aParams[
'default'] ==
'1' ) {
145 $iBaseId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
146 $this->_aLangData[
'urls'][$iBaseId] = $aParams[
'baseurl'];
147 $this->_aLangData[
'sslUrls'][$iBaseId] = $aParams[
'basesslurl'];
152 $this->_aViewData[
"updatelist"] =
"1";
156 $this->
getConfig()->saveShopConfVar(
'aarr',
'aLanguageParams', $this->_aLangData[
'params']);
157 $this->
getConfig()->saveShopConfVar(
'aarr',
'aLanguages', $this->_aLangData[
'lang']);
158 $this->
getConfig()->saveShopConfVar(
'arr',
'aLanguageURLs', $this->_aLangData[
'urls']);
159 $this->
getConfig()->saveShopConfVar(
'arr',
'aLanguageSSLURLs', $this->_aLangData[
'sslUrls']);
162 if ($blNewLanguage) {
171 $oEx =
oxNew(
'oxExceptionToDisplay');
172 $oEx->setMessage(
'LANGUAGE_ERRORGENERATEVIEWS');
187 $sDefaultLang = $this->
getConfig()->getConfigParam(
'sDefaultLang' );
189 $aLangData = $this->_aLangData[
'params'][$sOxId];
190 $aLangData[
'abbr'] = $sOxId;
191 $aLangData[
'desc'] = $this->_aLangData[
'lang'][$sOxId];
192 $aLangData[
'baseurl'] = $this->_aLangData[
'urls'][$aLangData[
'baseId']];
193 $aLangData[
'basesslurl'] = $this->_aLangData[
'sslUrls'][$aLangData[
'baseId']];
194 $aLangData[
'default'] = ($this->_aLangData[
'params'][$sOxId][
"baseId"] == $sDefaultLang) ?
true :
false;
208 $this->_aLangData = $aLangData;
220 $aLangData[
'params'] = $this->
getConfig()->getConfigParam(
'aLanguageParams' );
221 $aLangData[
'lang'] = $this->
getConfig()->getConfigParam(
'aLanguages' );
222 $aLangData[
'urls'] = $this->
getConfig()->getConfigParam(
'aLanguageURLs' );
223 $aLangData[
'sslUrls'] = $this->
getConfig()->getConfigParam(
'aLanguageSSLURLs' );
226 if ( !is_array( $aLangData[
'params']) ) {
243 foreach ( array_keys($this->_aLangData) as $sTypeKey ) {
245 if ( is_array($this->_aLangData[$sTypeKey]) && count($this->_aLangData[$sTypeKey]) > 0 ) {
247 if ( $sTypeKey ==
'urls' || $sTypeKey ==
'sslUrls' ) {
251 $aKeys = array_keys( $this->_aLangData[$sTypeKey] );
252 $aValues = array_values( $this->_aLangData[$sTypeKey] );
254 $iReplaceId = array_search( $sOldId, $aKeys );
255 $aKeys[$iReplaceId] = $sNewId;
257 $this->_aLangData[$sTypeKey] = array_combine( $aKeys, $aValues );
274 uasort( $this->_aLangData[
'params'], array($this,
'_sortLangParamsByBaseIdCallback') );
276 foreach ( $this->_aLangData[
'params'] as $sAbbr => $aParams ) {
277 $iId = (int)$aParams[
'baseId'];
278 $aUrls[$iId] = $this->_aLangData[
'urls'][$iId];
279 $aSslUrls[$iId] = $this->_aLangData[
'sslUrls'][$iId];
280 $aLanguages[$sAbbr] = $this->_aLangData[
'lang'][$sAbbr];
284 $this->_aLangData[
'urls'] = $aUrls;
285 $this->_aLangData[
'sslUrls'] = $aSslUrls;
301 $aParams[$sOxId][
'baseId'] = $iBaseId;
302 $aParams[$sOxId][
'active'] = 1;
303 $aParams[$sOxId][
'sort'] = $iBaseId + 1;
320 $sDefaultId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
321 $this->
getConfig()->saveShopConfVar(
'str',
'sDefaultLang', $sDefaultId );
332 foreach ( $this->_aLangData[
'params'] as
$aLang ) {
333 $aBaseId[] = $aLang[
'baseId'];
338 $iTotal = count($aBaseId);
341 while ( $iNewId <= $iTotal ) {
342 if ( $iNewId !== $aBaseId[$iNewId] ) {
363 $sDir = dirname(
$myConfig->getTranslationsDir(
'lang.php', $sOxId ) );
365 if ( empty($sDir) ) {
366 $oEx =
oxNew(
"oxExceptionToDisplay" );
367 $oEx->setMessage(
'LANGUAGE_NOTRANSLATIONS_WARNING' );
381 $iBaseId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
382 $sTable = getLangTableName(
'oxarticles', $iBaseId );
385 $oDbMetadata =
oxNew(
'oxDbMetaDataHandler');
386 return $oDbMetadata->tableExists( $sTable ) && $oDbMetadata->fieldExists( $sColumn, $sTable );
400 $oDbMeta =
oxNew(
"oxDbMetaDataHandler" );
403 $oDbMeta->addNewLangToDb();
409 echo $oEx->getMessage();
410 $oEx =
oxNew(
"oxExceptionToDisplay" );
411 $oEx->setMessage(
'LANGUAGE_ERROR_ADDING_MULTILANG_FIELDS' );
430 $aAbbrs = array_keys($this->_aLangData[
'lang']);
432 if ( in_array( $sAbbr, $aAbbrs ) ) {
450 return ($oLang1[
'baseId'] < $oLang2[
'baseId']) ? -1 : 1;
467 if ( $sOxId == -1 ) {
469 $oEx =
oxNew(
'oxExceptionToDisplay' );
470 $oEx->setMessage(
'LANGUAGE_ALREADYEXISTS_ERROR' );
478 $oEx =
oxNew(
'oxExceptionToDisplay');
479 $oEx->setMessage(
'LANGUAGE_ABBREVIATION_INVALID_ERROR');
485 if ( empty($aParams[
'desc']) ) {
486 $oEx =
oxNew(
'oxExceptionToDisplay' );
487 $oEx->setMessage(
'LANGUAGE_EMPTYLANGUAGENAME_ERROR' );
508 if (preg_match(
'/^[a-zA-Z0-9_]*$/', $sAbbreviation)) {
525 foreach ($aLanguageData as $mLanguageDataParameters) {
526 if (is_array($mLanguageDataParameters)) {
529 $blValid = $blDeepResult ===
false ? $blDeepResult : $blValid;
530 } elseif (!$configValidator->isValid($mLanguageDataParameters)) {
532 $error =
oxNew(
'oxDisplayError');
533 $error->setFormatParameters(htmlspecialchars($mLanguageDataParameters));
534 $error->setMessage(
"SHOP_CONFIG_ERROR_INVALID_VALUE");
547 if (is_null($this->oConfigValidator)) {
548 $this->oConfigValidator =
oxNew(
'oxNoJsValidator');