function mapLanguageKeys($language, $key_mapping, $type, $name) { global $lang; if (!defined('CCADMIN')) { $language = setNewLanguageValue($language, $lang, $type, $name); foreach ($key_mapping as $key => $value) { $language[$key] = $language[$value]; unset($language[$value]); } } return $language; }
function editlanguage() { global $body; global $navigation; global $rtl; global $languages; $plugins_core = setConfigValue('plugins_core', array()); $extensions_core = setConfigValue('extensions_core', array()); $modules_core = setConfigValue('modules_core', array()); $data = ''; $lang = $_GET['data']; if (empty($data)) { $rtly = ""; $rtln = ""; if ($rtl == 1) { $rtly = "checked"; } else { $rtln = "checked"; } $data .= '<div class="rtltitle">Right to left text:</div><div class="element"><input type="radio" id="rtl" lang_key = "rtl" name="rtl" value="1" ' . $rtly . ' onchange="javascript:language_updatelanguage($(this));" code="' . $lang . '" addontype="core" addonname="default">Yes <input id="rtl" type="radio" ' . $rtln . ' name="rtl" lang_key = "rtl" value="0" onchange="javascript:language_updatelanguage($(this));" code="' . $lang . '" addontype="core" addonname="default">No</div><div style="clear:both;padding:7.5px;"></div>'; } if (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'en.php')) { $array = 'language'; global ${$array}; include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'en.php'; ${$array} = setNewLanguageValue(${$array}, $lang, 'core', 'default'); $x = 0; $data .= '<h4 onclick="javascript:$(\'#' . md5('') . '\').slideToggle(\'slow\')">core</h4>'; $data .= '<div id="' . md5('') . '" style="display:none"><form>'; foreach (${$array} as $key => $value) { $x++; $data .= '<div style="clear:both"></div><div class="title langtitle" title="' . $key . '">' . $x . ':</div><div class="element"><textarea id="textarea_' . $lang . '_core_default_' . $key . '" lang_key = "' . $key . '" code="' . $lang . '" addontype="core" addonname="default" class="inputbox inputboxlong">' . stripslashes($value) . '</textarea><input type="button" value="Update" onclick="javascript:language_updatelanguage($(this));" class="button updatelanguage" /></div>'; } $data .= '</form></div>'; } $addontypes = array('modules', 'plugins', 'extensions'); foreach ($addontypes as $addon_type) { foreach (${$addon_type . "_core"} as $addon => $addondata) { if (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $addon_type . DIRECTORY_SEPARATOR . $addon . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'en.php')) { include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $addon_type . DIRECTORY_SEPARATOR . $addon . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'en.php'; $array = $addon . '_language'; ${$array} = setNewLanguageValue(${$array}, $lang, rtrim($addon_type, 's'), $addon); $data .= '<div style="clear:both"></div><h4 onclick="javascript:$(\'#' . md5($addon) . '\').slideToggle(\'slow\')">' . rtrim($addon_type, 's') . ': ' . $addon . '</h4>'; $data .= '<div id="' . md5($addon) . '" style="display:none"><form>'; $x = 0; foreach (${$array} as $key => $value) { $x++; $data .= '<div style="clear:both"></div><div title="' . $key . '" ><div class="title langtitle" >' . $x . ':</div><div class="element"><textarea id="textarea_' . $lang . '_' . $addon_type . '_' . $addon . '_' . $key . '" lang_key = "' . $key . '" code="' . $lang . '" addontype="' . rtrim($addon_type, 's') . '" addonname="' . $addon . '" class="inputbox inputboxlong">' . stripslashes($value) . '</textarea><input type="button" value="Update" onclick="javascript:language_updatelanguage($(this));" class="button updatelanguage" /></div></div>'; } $data .= '</form></div>'; } else { unset(${$addon_type . "_core"}[$addon]); } } } $body = <<<EOD \t{$navigation} \t<div id="rightcontent" style="float:left;width:720px;border-left:1px dotted #ccc;padding-left:20px;"> \t\t<h2>Edit language - {$lang}</h2> \t\t<h3>Please select the section you would like to edit.</h3> \t\t<div> \t\t\t<div id="centernav" class="centernavextend"> \t\t\t\t{$data} \t\t\t\t<div style="clear:both;padding:10px;"></div> \t\t\t</div> \t\t</div> \t</div> \t<div style="clear:both"></div> EOD; template(); }