From 720b53eb1ed97b0e72191aef9fb176e62fe6b5ac Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Thu, 6 Jun 2013 23:09:07 +0000 Subject: [PATCH] Multilinguified Upgrade Schema --- core/upgrade/app_languages.php | 25 +++++++++++++++++++++++++ core/upgrade/upgrade.php | 21 +++++++++++++++++---- core/upgrade/upgrade_schema.php | 15 +++++++++++++++ includes/lib_schema.php | 33 +++++++++++++++++---------------- 4 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 core/upgrade/app_languages.php diff --git a/core/upgrade/app_languages.php b/core/upgrade/app_languages.php new file mode 100644 index 0000000000..28f01ba456 --- /dev/null +++ b/core/upgrade/app_languages.php @@ -0,0 +1,25 @@ + diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php index 36f9ca1024..549ee40ea5 100644 --- a/core/upgrade/upgrade.php +++ b/core/upgrade/upgrade.php @@ -33,6 +33,12 @@ require_once "includes/require.php"; $_SERVER["DOCUMENT_ROOT"] = $document_root; $display_type = 'text'; //html, text + + //add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } } else { include "root.php"; @@ -45,6 +51,13 @@ echo "access denied"; exit; } + + //add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + } //set the default @@ -59,10 +72,10 @@ if ($display_type == 'text') { echo "\n"; - echo "Upgrade\n"; + echo $text['label-upgrade']."\n"; echo "-----------------------------------------\n"; echo "\n"; - echo "Database\n"; + echo $text['label-database']."\n"; } //upgrade the database schema @@ -73,10 +86,10 @@ if ($display_type == 'text') { echo "
\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "
Message".$text['header-message']."
Upgrade Completed".$text['message-upgrade']."
\n"; echo "
\n"; diff --git a/core/upgrade/upgrade_schema.php b/core/upgrade/upgrade_schema.php index c330294ab7..bf4e1bc7f3 100644 --- a/core/upgrade/upgrade_schema.php +++ b/core/upgrade/upgrade_schema.php @@ -33,6 +33,12 @@ require_once "includes/require.php"; $_SERVER["DOCUMENT_ROOT"] = $document_root; $display_type = 'text'; //html, text + + //add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } } else { include "root.php"; @@ -45,7 +51,16 @@ echo "access denied"; exit; } + + //add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + require_once "includes/header.php"; + $page["title"] = $text['title-upgrade_schema']; + $display_type = 'html'; //html, text } diff --git a/includes/lib_schema.php b/includes/lib_schema.php index 96def0f41d..013538164f 100644 --- a/includes/lib_schema.php +++ b/includes/lib_schema.php @@ -269,6 +269,7 @@ function db_insert_into ($apps, $db_type, $table) { } function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { + global $text; // pulls in language variable array global $display_type; //PHP PDO check if table or column exists @@ -514,7 +515,7 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { //display results as html if ($display_results && $display_type == "html") { //show the database type - echo "Database Type: ".$db_type. "

"; + echo "".$text['header-database_type'].": ".$db_type. "

"; //start the table echo "\n"; //show the changes @@ -522,7 +523,7 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; //build the html while looping through the app db array $sql = ''; @@ -550,17 +551,17 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { //check if the table exists if ($row['exists'] == "true") { - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; if (count($row['fields']) > 0) { echo "
\n"; echo "
\n"; - echo "SQL Changes:
\n"; + echo "".$text['label-sql_changes'].":
\n"; echo "
\n";
 					echo $sql_update;
 					echo "
\n"; @@ -532,9 +533,9 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { } //list all tables echo "
TableExistsDetails".$text['label-table']."".$text['label-exists']."".$text['label-details']."
table
$table_name
true".$table_name."".$text['option-true']."\n"; //show the list of columns echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; foreach ($row['fields'] as $field) { if ($field['deprecated'] == "true") { @@ -583,11 +584,11 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { echo "\n"; echo "\n"; if ($field['exists'] == "true") { - echo "\n"; + echo "\n"; echo "\n"; } else { - echo "\n"; + echo "\n"; echo "\n"; } echo "\n"; @@ -599,8 +600,8 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { } } else { - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; } echo "\n"; @@ -615,11 +616,11 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { //loop line by line through all the lines of sql code $x = 0; if (strlen($sql_update) == 0 && $display_type == "text") { - echo " Schema: no change\n"; + echo " ".$text['label-schema'].": ".$text['label-no_change']."\n"; } else { if ($display_type == "text") { - echo " Schema:\n"; + echo " ".$text['label-schema'].":\n"; } //$db->beginTransaction(); $update_array = explode(";", $sql_update);
nametypeexists".$text['label-name']."".$text['label-type']."".$text['label-exists']."
".$field_name."".$field_type."true".$text['option-true']." false".$text['option-false']." 
table
$table_name
exists
false
$table_name".$text['label-exists']."
".$text['option-false']."