[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] setup lang.php [Version-0_9_16-branch]
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] setup lang.php [Version-0_9_16-branch] |
Date: |
Wed, 18 Oct 2006 13:29:17 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: setup
Branch: Version-0_9_16-branch
Changes by: Dave Hall <skwashd> 06/10/18 13:29:17
Modified files:
. : lang.php
Log message:
backported fix from HEAD, not thoroughly tested for regressions, but it
should work fine
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/setup/lang.php?cvsroot=phpgroupware&only_with_tag=Version-0_9_16-branch&r1=1.46.2.8&r2=1.46.2.9
Patches:
Index: lang.php
===================================================================
RCS file: /cvsroot/phpgroupware/setup/lang.php,v
retrieving revision 1.46.2.8
retrieving revision 1.46.2.9
diff -u -b -r1.46.2.8 -r1.46.2.9
--- lang.php 6 Nov 2004 16:13:46 -0000 1.46.2.8
+++ lang.php 18 Oct 2006 13:29:17 -0000 1.46.2.9
@@ -1,26 +1,31 @@
<?php
- /**************************************************************************\
- * phpGroupWare - Setup *
- * http://www.phpgroupware.org *
- * -------------------------------------------- *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by the *
- * Free Software Foundation; either version 2 of the License, or (at your *
- * option) any later version. *
- \**************************************************************************/
-
- /* $Id: lang.php,v 1.46.2.8 2004/11/06 16:13:46 powerstat Exp $ */
+ /**
+ * Setup
+ *
+ * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package setup
+ * @version $Id: lang.php,v 1.46.2.9 2006/10/18 13:29:17 skwashd Exp $
+ */
$phpgw_info = array();
- if (address@hidden)
+ if ( !isset($included) || !$included )
{
- $GLOBALS['phpgw_info']['flags'] = array(
+ $GLOBALS['phpgw_info']['flags'] = array
+ (
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
+ $included = '';
+ $newinstall = false;
+
+ /**
+ * Include setup functions
+ */
include('./inc/functions.inc.php');
+
// Authorize the user to use setup app and load the database
// Does not return unless user is authorized
if (!$GLOBALS['phpgw_setup']->auth('Config'))
@@ -30,16 +35,20 @@
}
$GLOBALS['phpgw_setup']->loaddb();
+ /**
+ * Include API Common class
+ */
include(PHPGW_API_INC.'/class.common.inc.php');
+
$common = new common;
// this is not used
//$sep = $common->filesystem_separator();
}
elseif ($included != 'from_login')
{
- $newinstall = True;
+ $newinstall = true;
$lang_selected['en'] = 'en';
- $submit = True;
+ $submit = true;
}
if (!defined('MAX_MESSAGE_ID_LENGTH'))
@@ -47,10 +56,16 @@
define('MAX_MESSAGE_ID_LENGTH',230);
}
- if (@$_POST['submit'])
+ if (isset($_POST['submit']) && $_POST['submit'] )
{
- $lang_selected = @$_POST['lang_selected'];
- $upgrademethod = @$_POST['upgrademethod'];
+ if ( !isset($GLOBALS['phpgw']->shm)
+ || !is_object($GLOBALS['phpgw']->shm) )
+ {
+ $GLOBALS['phpgw']->shm = CreateObject('phpgwapi.shm');
+ }
+
+ $lang_selected = $_POST['lang_selected'];
+ $upgrademethod = $_POST['upgrademethod'];
if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod
!= 'dumpold')
{
@@ -74,6 +89,7 @@
foreach($lang_selected as $lang)
{
//echo '<br />Working on: ' . $lang;
+ $GLOBALS['phpgw']->shm->delete_key('lang_' .
$lang);
$addlang = False;
if ($upgrademethod == 'addonlynew')
{
@@ -96,15 +112,24 @@
// Visit each app/setup dir, look for a
phpgw_lang file
while (list($key,$app) =
each($setup_info))
{
- $appfile = PHPGW_SERVER_ROOT .
SEP . @$app['name'] . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) .
'.lang';
+ $appfile = PHPGW_SERVER_ROOT .
SEP . $app['name'] . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) .
'.lang';
//echo '<br />Checking in: ' .
$app['name'];
-
if($GLOBALS['phpgw_setup']->app_registered(@$app['name']) &&
file_exists($appfile))
+
if($GLOBALS['phpgw_setup']->app_registered($app['name']) &&
file_exists($appfile))
{
//echo '<br
/>Including: ' . $appfile;
$lines = file($appfile);
foreach($lines as $line)
{
list($message_id,$app_name,,$content) = explode("\t",$line);
+ /* XXX Caeies
Get invalid lang files ...
+
if(empty($content))
+ {
+
_debug_array('Invalid lang line : '.$line);
+
_debug_array('content 1 : -'.$message_id.'-');
+
_debug_array('content 2 : -'.$app_name.'-');
+
_debug_array('content 3 : -'.$content.'-');
+ }
+ */
$message_id =
$GLOBALS['phpgw_setup']->db->db_addslashes(substr(chop($message_id),0,MAX_MESSAGE_ID_LENGTH));
$app_name =
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name));
$content =
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($content));
@@ -133,7 +158,7 @@
}
}
- if ($addit ||
@$newinstall || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold')
+ if ($addit ||
(isset($newinstall) && $newinstall) || $upgrademethod == 'addonlynew' ||
$upgrademethod == 'dumpold')
{
if($message_id
&& $content)
{
@@ -155,7 +180,7 @@
$GLOBALS['phpgw_setup']->db->query("INSERT INTO
phpgw_config(config_app,config_name,config_value) VALUES
('phpgwapi','lang_ctimes','".
addslashes(serialize($GLOBALS['phpgw_info']['server']['lang_ctimes']))."')",__LINE__,__FILE__);
}
- if(address@hidden)
+ if ( !$included )
{
Header('Location: index.php');
exit;
@@ -163,17 +188,18 @@
}
else
{
- if (@$_POST['cancel'])
+ if ( isset($_POST['cancel']) && $_POST['cancel'] )
{
Header('Location: index.php');
exit;
}
- if (address@hidden)
+ if ( !$included )
{
$tpl_root =
$GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
$setup_tpl =
CreateObject('phpgwapi.Template',$tpl_root);
- $setup_tpl->set_file(array(
+ $setup_tpl->set_file(array
+ (
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
@@ -184,10 +210,10 @@
$stage_title = lang('Multi-Language support setup');
$stage_desc = lang('This program will help you upgrade
or install different languages for phpGroupWare');
- $tbl_width = @$newinstall ? '60%' : '80%';
- $td_colspan = @$newinstall ? '1' : '2';
- $td_align = @$newinstall ? ' align="center"' : '';
- $hidden_var1 = @$newinstall ? '<input type="hidden"
name="newinstall" value="True">' : '';
+ $tbl_width = $newinstall ? '60%' : '80%';
+ $td_colspan = $newinstall ? '1' : '2';
+ $td_align = $newinstall ? ' align="center"' : '';
+ $hidden_var1 = $newinstall ? '<input type="hidden"
name="newinstall" value="True">' : '';
$dir = dir('../phpgwapi/setup');
while(($file = $dir->read()) !== false)
@@ -198,34 +224,28 @@
}
}
- if (address@hidden &&
!isset($GLOBALS['phpgw_info']['setup']['installed_langs']))
+ if (!$newinstall &&
!isset($GLOBALS['phpgw_info']['setup']['installed_langs']))
{
$GLOBALS['phpgw_setup']->detection->check_lang(false); // get installed langs
}
$select_box_desc = lang('Select which languages you
would like to use');
$select_box = '';
- $db2 = $GLOBALS['phpgw_setup']->db;
+
$GLOBALS['phpgw_setup']->db->query('SELECT
lang_id,lang_name, available '
. 'FROM phpgw_languages
'
- . 'WHERE lang_id
IN('.implode(',', $avail_lang).')');
+ . 'WHERE lang_id
IN('.implode(',', $avail_lang).') ORDER BY lang_name');
+ $select_box_langs = '';
while ($GLOBALS['phpgw_setup']->db->next_record())
{
$id = $GLOBALS['phpgw_setup']->db->f('lang_id');
- $select_box_langs =
- @$select_box_langs
- .'<option value="' . $id . '"'
-
.(@$GLOBALS['phpgw_info']['setup']['installed_langs'][$id]?' SELECTED':'').'>'
- .
$GLOBALS['phpgw_setup']->db->f('lang_name') . '</option>'
- ."\n";
-
if(strtoupper($GLOBALS['phpgw_setup']->db->f('available')) != 'YES')
- {
- $db2->query("UPDATE phpgw_languages SET
available = 'Yes' "
- ."WHERE
lang_id='".$GLOBALS['phpgw_setup']->db->f('lang_id')."'");
- }
+ $selected =
isset($GLOBALS['phpgw_info']['setup']['installed_langs'][$id]) ? ' selected' :
'';
+ $select_box_langs .= "<option
value=\"$id\"{$selected}>" . $GLOBALS['phpgw_setup']->db->f('lang_name') .
"</option>\n";
}
- if (address@hidden)
+ $GLOBALS['phpgw_setup']->db->query("UPDATE
phpgw_languages SET available = 'Yes' WHERE lang_id IN('" . implode("','",
$avail_lang) . "'");
+
+ if ( !$newinstall )
{
$meth_desc = lang('Select which method of
upgrade you would like to do');
$blurb_addonlynew = lang('Only add languages
that are not in the database already');
- [Phpgroupware-cvs] setup lang.php [Version-0_9_16-branch],
Dave Hall <=