phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] setup lang.php


From: Dave Hall
Subject: [Phpgroupware-cvs] setup lang.php
Date: Fri, 29 Sep 2006 11:44:44 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    setup
Changes by:     Dave Hall <skwashd>     06/09/29 11:44:44

Modified files:
        .              : lang.php 

Log message:
        fix multiple reload bug

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/setup/lang.php?cvsroot=phpgroupware&r1=1.53&r2=1.54

Patches:
Index: lang.php
===================================================================
RCS file: /cvsroot/phpgroupware/setup/lang.php,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- lang.php    29 Sep 2006 10:21:10 -0000      1.53
+++ lang.php    29 Sep 2006 11:44:44 -0000      1.54
@@ -5,18 +5,21 @@
        * @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.53 2006/09/29 10:21:10 Caeies Exp $
+       * @version $Id: lang.php,v 1.54 2006/09/29 11:44:44 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
@@ -43,9 +46,9 @@
        }
        elseif ($included != 'from_login')
        {
-               $newinstall          = True;
+               $newinstall = true;
                $lang_selected['en'] = 'en';
-               $submit              = True;
+               $submit = true;
        }
 
        if (!defined('MAX_MESSAGE_ID_LENGTH'))
@@ -53,15 +56,15 @@
                define('MAX_MESSAGE_ID_LENGTH',230);
        }
 
-       if (@$_POST['submit'])
+       if (isset($_POST['submit']) && $_POST['submit'] )
        {
                if(!is_object($GLOBALS['phpgw']->shm))
                {
                        $GLOBALS['phpgw']->shm = CreateObject('phpgwapi.shm');
                }
                                
-               $lang_selected = @$_POST['lang_selected'];
-               $upgrademethod = @$_POST['upgrademethod'];
+               $lang_selected = $_POST['lang_selected'];
+               $upgrademethod = $_POST['upgrademethod'];
                
                if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod 
!= 'dumpold')
                {
@@ -108,9 +111,9 @@
                                        // 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);
@@ -154,7 +157,7 @@
                                                                }
                                                        }
 
-                                                       if ($addit || 
@$newinstall || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold')
+                                                       if ($addit || 
$newinstall || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold')
                                                        {
                                                                if($message_id 
&& $content)
                                                                {
@@ -176,7 +179,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;
@@ -184,17 +187,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',
@@ -205,10 +209,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)
@@ -219,34 +223,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="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');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]