diff --git a/catalog/admin/define_language.php b/catalog/admin/define_language.php index 87eb0727f..c0063e9d1 100644 --- a/catalog/admin/define_language.php +++ b/catalog/admin/define_language.php @@ -1,18 +1,163 @@ getFile('template_top.php')); + * osCommerce Online Merchant + * + * @copyright (c) 2016 osCommerce; https://www.oscommerce.com + * @license MIT; https://www.oscommerce.com/license/mit.txt + */ + + use OSC\OM\Cache; + use OSC\OM\DateTime; + use OSC\OM\HTML; + use OSC\OM\OSCOM; + + require('includes/application_top.php'); + + $action = (isset($_GET['action']) ? $_GET['action'] : ''); + + if (tep_not_null($action)) { + switch ($action) { + case 'save': + + if (isset($_GET['content_group'])) $content_group = $_GET['content_group']; + if (isset($_POST['definition_key'])) $definition_key = $_POST['definition_key']; + if (isset($_POST['definition_value'])) $definition_value = $_POST['definition_value']; + + foreach ($definition_value as $id => $definition) { + $sql_data_array = array( + 'definition_value' => $definition + ); + $OSCOM_Db->save('languages_definitions', $sql_data_array, ['id' => (int)$id]); + } + + $group = str_replace("-", "/", $content_group) . '.txt'; + $file = OSCOM::getConfig('dir_root', 'Shop') . 'includes/languages/' . $OSCOM_Language->get('directory', $OSCOM_Language->get('code')) . '/' . $group; + unlink($file); + + $languages_definitions_array = array_combine ($definition_key, $definition_value); + foreach ($languages_definitions_array as $defKey => $defVal) { + $data = $defKey . ' = ' . $defVal; + file_put_contents($file, $data . PHP_EOL, FILE_APPEND | LOCK_EX); + } + + Cache::clear('languages-defs-' . $content_group . '-lang' . $OSCOM_Language->getId()); + + OSCOM::redirect('define_language.php', 'content_group=' . $content_group . '&action=edit'); + } + } + $languages = tep_get_languages(); + + require($oscTemplate->getFile('template_top.php')); + + $heading_title = isset($_GET['content_group']) ? OSCOM::getDef('heading_title_2', ['content_group' => $_GET['content_group']]) : OSCOM::getDef('heading_title'); + ?> + +
This page will return in the next beta release.
+= OSCOM::getDef('table_heading_definition_key'); ?> | += OSCOM::getDef('table_heading_definition_value'); ?> | +
---|---|
= $Qdefinitions->value('definition_key'); ?> | ++ |