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;
206 $this->_aLangData = $aLangData;
218 $aLangData[
'params'] = $this->
getConfig()->getConfigParam(
'aLanguageParams');
219 $aLangData[
'lang'] = $this->
getConfig()->getConfigParam(
'aLanguages');
220 $aLangData[
'urls'] = $this->
getConfig()->getConfigParam(
'aLanguageURLs');
221 $aLangData[
'sslUrls'] = $this->
getConfig()->getConfigParam(
'aLanguageSSLURLs');
224 if (!is_array($aLangData[
'params'])) {
239 foreach (array_keys($this->_aLangData) as $sTypeKey) {
241 if (is_array($this->_aLangData[$sTypeKey]) && count($this->_aLangData[$sTypeKey]) > 0) {
243 if ($sTypeKey ==
'urls' || $sTypeKey ==
'sslUrls') {
247 $aKeys = array_keys($this->_aLangData[$sTypeKey]);
248 $aValues = array_values($this->_aLangData[$sTypeKey]);
250 $iReplaceId = array_search($sOldId, $aKeys);
251 $aKeys[$iReplaceId] = $sNewId;
253 $this->_aLangData[$sTypeKey] = array_combine($aKeys, $aValues);
268 uasort($this->_aLangData[
'params'], array($this,
'_sortLangParamsByBaseIdCallback'));
270 foreach ($this->_aLangData[
'params'] as $sAbbr => $aParams) {
271 $iId = (int) $aParams[
'baseId'];
272 $aUrls[$iId] = $this->_aLangData[
'urls'][$iId];
273 $aSslUrls[$iId] = $this->_aLangData[
'sslUrls'][$iId];
274 $aLanguages[$sAbbr] = $this->_aLangData[
'lang'][$sAbbr];
278 $this->_aLangData[
'urls'] = $aUrls;
279 $this->_aLangData[
'sslUrls'] = $aSslUrls;
295 $aParams[$sOxId][
'baseId'] = $iBaseId;
296 $aParams[$sOxId][
'active'] = 1;
297 $aParams[$sOxId][
'sort'] = $iBaseId + 1;
312 $sDefaultId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
313 $this->
getConfig()->saveShopConfVar(
'str',
'sDefaultLang', $sDefaultId);
324 foreach ($this->_aLangData[
'params'] as
$aLang) {
325 $aBaseId[] = $aLang[
'baseId'];
330 $iTotal = count($aBaseId);
333 while ($iNewId <= $iTotal) {
334 if ($iNewId !== $aBaseId[$iNewId]) {
353 $sDir = dirname(
$myConfig->getTranslationsDir(
'lang.php', $sOxId));
356 $oEx =
oxNew(
"oxExceptionToDisplay");
357 $oEx->setMessage(
'LANGUAGE_NOTRANSLATIONS_WARNING');
371 $iBaseId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
372 $sTable = getLangTableName(
'oxarticles', $iBaseId);
375 $oDbMetadata =
oxNew(
'oxDbMetaDataHandler');
377 return $oDbMetadata->tableExists($sTable) && $oDbMetadata->fieldExists($sColumn, $sTable);
391 $oDbMeta =
oxNew(
"oxDbMetaDataHandler");
394 $oDbMeta->addNewLangToDb();
400 echo $oEx->getMessage();
401 $oEx =
oxNew(
"oxExceptionToDisplay");
402 $oEx->setMessage(
'LANGUAGE_ERROR_ADDING_MULTILANG_FIELDS');
421 $aAbbrs = array_keys($this->_aLangData[
'lang']);
423 if (in_array($sAbbr, $aAbbrs)) {
441 return ($oLang1[
'baseId'] < $oLang2[
'baseId']) ? -1 : 1;
460 $oEx =
oxNew(
'oxExceptionToDisplay');
461 $oEx->setMessage(
'LANGUAGE_ALREADYEXISTS_ERROR');
469 $oEx =
oxNew(
'oxExceptionToDisplay');
470 $oEx->setMessage(
'LANGUAGE_ABBREVIATION_INVALID_ERROR');
476 if (empty($aParams[
'desc'])) {
477 $oEx =
oxNew(
'oxExceptionToDisplay');
478 $oEx->setMessage(
'LANGUAGE_EMPTYLANGUAGENAME_ERROR');
499 if (preg_match(
'/^[a-zA-Z0-9_]*$/', $sAbbreviation)) {
516 foreach ($aLanguageData as $mLanguageDataParameters) {
517 if (is_array($mLanguageDataParameters)) {
520 $blValid = $blDeepResult ===
false ? $blDeepResult : $blValid;
521 } elseif (!$configValidator->isValid($mLanguageDataParameters)) {
523 $error =
oxNew(
'oxDisplayError');
524 $error->setFormatParameters(htmlspecialchars($mLanguageDataParameters));
525 $error->setMessage(
"SHOP_CONFIG_ERROR_INVALID_VALUE");
538 if (is_null($this->oConfigValidator)) {
539 $this->oConfigValidator =
oxNew(
'oxNoJsValidator');