From bd4404cb142fdf128655202c648f69d26596972b Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 29 May 2013 22:27:04 +0000 Subject: [PATCH] Multilinguified Variables. --- app/vars/app_languages.php | 48 ++++++++++++++++++++++++++ app/vars/var_delete.php | 8 ++++- app/vars/var_edit.php | 69 +++++++++++++++++++++----------------- app/vars/vars.php | 42 ++++++++++++++--------- app/vars/vars_textarea.php | 32 +++++++++++------- 5 files changed, 139 insertions(+), 60 deletions(-) create mode 100644 app/vars/app_languages.php diff --git a/app/vars/app_languages.php b/app/vars/app_languages.php new file mode 100644 index 0000000000..c5f7b4f5e3 --- /dev/null +++ b/app/vars/app_languages.php @@ -0,0 +1,48 @@ + \ No newline at end of file diff --git a/app/vars/var_delete.php b/app/vars/var_delete.php index 377032fc77..1ffc255849 100644 --- a/app/vars/var_delete.php +++ b/app/vars/var_delete.php @@ -34,6 +34,12 @@ else { exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + if (count($_GET)>0) { $id = $_GET["id"]; } @@ -53,7 +59,7 @@ if (count($_GET)>0) { require_once "includes/header.php"; echo "\n"; echo "
\n"; - echo "Delete Complete\n"; + echo $text['message-delete']."\n"; echo "
\n"; require_once "includes/footer.php"; return; diff --git a/app/vars/var_edit.php b/app/vars/var_edit.php index ab96e3a34a..165cc389ed 100644 --- a/app/vars/var_edit.php +++ b/app/vars/var_edit.php @@ -34,6 +34,12 @@ else { exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + //set the action as an add or an update if (isset($_REQUEST["id"])) { $action = "update"; @@ -65,12 +71,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //check for all required data - if (strlen($var_name) == 0) { $msg .= "Please provide: Name
\n"; } - //if (strlen($var_value) == 0) { $msg .= "Please provide: Value
\n"; } - //if (strlen($var_cat) == 0) { $msg .= "Please provide: Category
\n"; } - if (strlen($var_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } - if (strlen($var_order) == 0) { $msg .= "Please provide: Order
\n"; } - //if (strlen($var_description) == 0) { $msg .= "Please provide: Description
\n"; } + if (strlen($var_name) == 0) { $msg .= $text['message-required'].$text['label-name']."
\n"; } + //if (strlen($var_value) == 0) { $msg .= $text['message-required'].$text['label-value']."
\n"; } + //if (strlen($var_cat) == 0) { $msg .= $text['message-required'].$text['label-category']."
\n"; } + if (strlen($var_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } + if (strlen($var_order) == 0) { $msg .= $text['message-required'].$text['label-order']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; @@ -121,7 +126,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; echo "\n"; echo "
\n"; - echo "Add Complete\n"; + echo $text['message-add']."\n"; echo "
\n"; require_once "includes/footer.php"; return; @@ -149,7 +154,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; echo "\n"; echo "
\n"; - echo "Update Complete\n"; + echo $text['message-update']."\n"; echo "
\n"; require_once "includes/footer.php"; return; @@ -179,6 +184,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //include header require_once "includes/header.php"; + if ($action == "add") { + $page["title"] = $text['title-variable_add']; + } + if ($action == "update") { + $page["title"] = $text['title-variable_edit']; + } //show contents echo "
"; @@ -193,67 +204,66 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; if ($action == "add") { - echo "Variable Add\n"; + echo "".$text['header-variable_add']."\n"; } if ($action == "update") { - echo "Variable Edit\n"; + echo "".$text['header-variable_edit']."\n"; } - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " Name:\n"; + echo " ".$text['label-name'].":\n"; echo "\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the variable name here. \n"; + echo $text['description-name']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " Value:\n"; + echo " ".$text['label-value'].":\n"; echo "\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the variable value here. \n"; + echo $text['description-value']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " Category:\n"; + echo " ".$text['label-category'].":\n"; echo "\n"; echo "\n"; $table_name = 'v_vars';$field_name = 'var_cat';$sql_where_optional = "";$field_current_value = $var_cat; echo html_select_other($db, $table_name, $field_name, $sql_where_optional, $field_current_value); - //echo " \n"; echo "
\n"; - echo "Enter the category here.\n"; + echo $text['description-category']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " Enabled:\n"; + echo " ".$text['label-enabled'].":\n"; echo "\n"; echo "\n"; echo " \n"; echo "
\n"; @@ -263,11 +273,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; - echo " Order:\n"; + echo " ".$text['label-order'].":\n"; echo "\n"; echo "\n"; echo " \n"; @@ -306,7 +315,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { echo " \n"; } - echo " \n"; + echo " \n"; echo " \n"; echo " "; @@ -315,7 +324,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo "
\n"; - echo "Codec Information:
\n"; + echo "".$text['label-codec_information']."

\n"; echo "Module must be compiled and loaded.     codecname[@8000h|16000h|32000h[@XXi]]
\n"; echo "
\n"; echo "XX is the frame size must be multples allowed for the codec
\n"; diff --git a/app/vars/vars.php b/app/vars/vars.php index 907aa3a4e4..478b71d958 100644 --- a/app/vars/vars.php +++ b/app/vars/vars.php @@ -34,8 +34,15 @@ else { exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + //include the header require_once "includes/header.php"; + $page["title"] = $text['title-variables']; //set http values as php variables $order_by = $_GET["order_by"]; @@ -50,8 +57,8 @@ else { echo "\n"; echo " \n"; - echo " \n"; echo " \n"; echo "
Variables
\n"; - echo " Define preprocessor variables here. \n"; + echo "
".$text['header-variables']."
\n"; + echo " ".$text['description-variables']."\n"; echo "
\n"; @@ -78,15 +85,13 @@ else { $tmp_var_header = ''; $tmp_var_header .= "\n"; - $tmp_var_header .= th_order_by('var_name', 'Name', $order_by, $order); - $tmp_var_header .= th_order_by('var_value', 'Value', $order_by, $order); - //$tmp_var_header .= th_order_by('var_cat', 'Category', $order_by, $order); - //$tmp_var_header .= th_order_by('var_order', 'Order', $order_by, $order); - $tmp_var_header .= th_order_by('var_enabled', 'Enabled', $order_by, $order); - $tmp_var_header .= "Description\n"; + $tmp_var_header .= th_order_by('var_name', $text['label-name'], $order_by, $order); + $tmp_var_header .= th_order_by('var_value', $text['label-value'], $order_by, $order); + $tmp_var_header .= th_order_by('var_enabled', $text['label-enabled'], $order_by, $order); + $tmp_var_header .= "".$text['label-description']."\n"; $tmp_var_header .= "\n"; if (permission_exists('variables_add')) { - $tmp_var_header .= " $v_link_label_add\n"; + $tmp_var_header .= " $v_link_label_add\n"; } $tmp_var_header .= "\n"; $tmp_var_header .= "\n"; @@ -107,7 +112,7 @@ else { echo "  \n"; echo " \n"; if (permission_exists('variables_add')) { - echo " $v_link_label_add\n"; + echo " $v_link_label_add\n"; } echo " \n"; echo " \n"; @@ -125,18 +130,23 @@ else { echo "\n"; echo " ".substr($row['var_name'],0,32)." \n"; echo " ".substr($var_value,0,30)." \n"; - //echo " ".$row['var_cat']."\n"; - //echo " ".$row['var_order']."\n"; - echo " ".$row['var_enabled']."\n"; + echo " "; + if ($row['var_enabled'] == "true") { + echo $text['option-true']; + } + else if ($row['var_enabled'] == "false") { + echo $text['option-false']; + } + echo "\n"; $var_description = str_replace("\n", "
", trim(substr(base64_decode($row['var_description']),0,40))); $var_description = str_replace(" ", "       ", $var_description); echo " ".$var_description." \n"; echo " \n"; if (permission_exists('variables_edit')) { - echo " $v_link_label_edit\n"; + echo " $v_link_label_edit\n"; } if (permission_exists('variables_delete')) { - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\n"; } echo " \n"; echo "\n"; @@ -155,7 +165,7 @@ else { echo " $paging_controls\n"; echo " \n"; if (permission_exists('variables_add')) { - echo " $v_link_label_add\n"; + echo " $v_link_label_add\n"; } echo " \n"; echo " \n"; diff --git a/app/vars/vars_textarea.php b/app/vars/vars_textarea.php index a90c485a9b..a6db42d7b0 100644 --- a/app/vars/vars_textarea.php +++ b/app/vars/vars_textarea.php @@ -34,8 +34,15 @@ else { exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + //include the header require_once "includes/header.php"; + $page["title"] = $text['title-variables_advanced']; //restore the default vars.xml if ($_GET['a'] == "default" && permission_exists('variables_edit')) { @@ -43,7 +50,7 @@ if ($_GET['a'] == "default" && permission_exists('variables_edit')) { $fd = fopen($_SESSION['switch']['conf']['dir'].".orig/vars.xml", "r"); $v_content = fread($fd, filesize($_SESSION['switch']['conf']['dir'].".orig/vars.xml")); fclose($fd); - + //write the default config fget $fd = fopen($_SESSION['switch']['conf']['dir']."/vars.xml", "w"); fwrite($fd, $v_content); @@ -66,16 +73,16 @@ if ($_GET['a'] == "default" && permission_exists('variables_edit')) { fclose($fd); //edit area - echo " \n"; + echo " \n"; echo "