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.

+ + + + + + + + + + + prepare('select id, definition_key, definition_value from :table_languages_definitions where content_group = :content_group and languages_id = :languages_id '); + $Qdefinitions->bindValue(':content_group', $_GET['content_group']); + $Qdefinitions->bindInt(':languages_id', $languages[$i]['id']); + $Qdefinitions->execute(); + + while ($Qdefinitions->fetch()) { + ?> + + + + + + + +
value('definition_key'); ?>
+ +
+
+
+
+
+ +
+ + +
+
+ getFile('template_bottom.php')); - require('includes/application_bottom.php'); + } + if ( empty($action) && !isset($_GET['content_group']) ) { + ?> + + + + + + + + + + + prepare('select distinct content_group from :table_languages_definitions'); + $Qcontent_group->execute(); + + while ($Qcontent_group->fetch()) { + ?> + + + + + + +
value('content_group'); ?>
+ + getFile('template_bottom.php')); + require('includes/application_bottom.php'); ?> diff --git a/catalog/admin/includes/languages/english/define_language.txt b/catalog/admin/includes/languages/english/define_language.txt index bd03dd7ca..4c88356ae 100644 --- a/catalog/admin/includes/languages/english/define_language.txt +++ b/catalog/admin/includes/languages/english/define_language.txt @@ -1,4 +1,9 @@ -heading_title = Define Languages +heading_title = Define Language +heading_title_2 = Define Language :: [ {{content_group}} ] +table_heading_definition_key = Definition key +table_heading_definition_value = Definition value +table_heading_content_group_title = Content group +table_heading_content_group_action = Action table_heading_files = Files table_heading_writable = Writable table_heading_last_modified = Last Modified