From c76e53cc0c142e2cd745a3842c0177280b5e00fb Mon Sep 17 00:00:00 2001 From: seek3r Date: Mon, 1 Jan 2001 11:50:35 +0000 Subject: [PATCH] added lang support --- setup/inc/phpgw_setup.inc.php | 57 ++++++++++++++++++++++++++--------- setup/index.php | 14 +++++++-- setup/lang.php | 7 ++--- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/setup/inc/phpgw_setup.inc.php b/setup/inc/phpgw_setup.inc.php index 67b4d07969..63bc473b9f 100644 --- a/setup/inc/phpgw_setup.inc.php +++ b/setup/inc/phpgw_setup.inc.php @@ -201,14 +201,14 @@ } if (isset($phpgw_info["setup"]["oldver"]["phpgwapi"])){ if ($phpgw_info["setup"]["oldver"]["phpgwapi"] == $phpgw_info["server"]["versions"]["phpgwapi"]){ - $phpgw_info["setup"]["header_msg"] = "Stage 2 (Tables Complete)"; + $phpgw_info["setup"]["header_msg"] = "Stage 1 (Tables Complete)"; return 10; }else{ - $phpgw_info["setup"]["header_msg"] = "Stage 2 (Tables need upgrading)"; + $phpgw_info["setup"]["header_msg"] = "Stage 1 (Tables need upgrading)"; return 4; } }else{ - $phpgw_info["setup"]["header_msg"] = "Stage 2 (Tables appear to be pre-beta)"; + $phpgw_info["setup"]["header_msg"] = "Stage 1 (Tables appear to be pre-beta)"; return 2; } }else{ @@ -223,10 +223,10 @@ if (isset($db_rights)){ //if (isset($isdb)){ - $phpgw_info["setup"]["header_msg"] = "Stage 2 (Create tables)"; + $phpgw_info["setup"]["header_msg"] = "Stage 1 (Create tables)"; return 3; }else{ - $phpgw_info["setup"]["header_msg"] = "Stage 2 (Create Database)"; + $phpgw_info["setup"]["header_msg"] = "Stage 1 (Create Database)"; return 1; } } @@ -236,17 +236,44 @@ { global $phpgw_info; $this->db->Halt_On_Error = "no"; - if ($phpgw_info["setup"]["stage"]["db"] == 10){ - $this->db->query("select config_value from config where config_name='freshinstall'"); - $this->db->next_record(); - $configed = $this->db->f("config_value"); - if ($configed){ - $phpgw_info["setup"]["header_msg"] = "Stage 3 (Needs Configuration)"; - return 1; - }else{ - $phpgw_info["setup"]["header_msg"] = "Stage 3 (Configuration OK)"; - return 10; + if ($phpgw_info["setup"]["stage"]["db"] != 10){return "";} + + $this->db->query("select config_value from config where config_name='freshinstall'"); + $this->db->next_record(); + $configed = $this->db->f("config_value"); + if ($configed){ + $phpgw_info["setup"]["header_msg"] = "Stage 2 (Needs Configuration)"; + return 1; + }else{ + $phpgw_info["setup"]["header_msg"] = "Stage 2 (Configuration OK)"; + return 10; + } + + } + + function check_lang() + { + global $phpgw_info; + $this->db->Halt_On_Error = "no"; + if ($phpgw_info["setup"]["stage"]["db"] != 10){return "";} + + $this->db->query("select distinct lang from lang;"); + if ($this->db->num_rows() == 0){ + $phpgw_info["setup"]["header_msg"] = "Stage 3 (No languages installed)"; + return 1; + }else{ + while (@$this->db->next_record()) { + $phpgw_info["setup"]["installed_langs"][$this->db->f("lang")] = $this->db->f("lang"); } + reset ($phpgw_info["setup"]["installed_langs"]); + while (list ($key, $value) = each ($phpgw_info["setup"]["installed_langs"])) { + $sql = "select lang_name from languages where lang_id = '".$value."';"; + $this->db->query($sql); + $this->db->next_record(); + $phpgw_info["setup"]["installed_langs"][$value] = $this->db->f("lang_name"); + } + $phpgw_info["setup"]["header_msg"] = "Stage 3 (Completed)"; + return 10; } } diff --git a/setup/index.php b/setup/index.php index 94cdb5152a..ae1c31bfeb 100644 --- a/setup/index.php +++ b/setup/index.php @@ -192,12 +192,22 @@ } echo ' Step 3 - language management '; + $phpgw_info["setup"]["stage"]["lang"] = $phpgw_setup->check_lang(); switch($phpgw_info["setup"]["stage"]["lang"]){ case 1: - echo 'OYou are ready for this stage, but this stage is not yet written.
'; + echo 'OYou do not have any languages installed. Please install one now
'; + echo "
"; break; case 10: - echo 'OThis stage is completed
'; + echo 'OThis stage is completed
'; + echo "Currently installed languages: "; + reset ($phpgw_info["setup"]["installed_langs"]); + while (list ($key, $value) = each ($phpgw_info["setup"]["installed_langs"])) { + if (!$notfirst){ echo $value; }else{ echo ", ".$value; } + $notfirst = True; + } + echo "
"; + echo "
"; break; default: echo 'ONot ready for this stage yet.'; diff --git a/setup/lang.php b/setup/lang.php index 5cffedc6d0..58ca9e8fae 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -24,9 +24,6 @@ } $phpgw_setup->loaddb(); - echo "phpGroupWare Setup\n"; - echo "\n"; - include($phpgw_info["server"]["api_inc"]."/phpgw_common.inc.php"); $common = new common; $sep = $common->filesystem_separator(); @@ -85,8 +82,8 @@ } if (! $included) { - echo "
Language files have been installed
"; - exit; + Header("Location: index.php"); + exit; } } else {