Change lang/languages tables to phpgw_lang/phpgw_languages

This commit is contained in:
Miles Lott 2002-02-17 19:31:50 +00:00
parent 50c595ff8b
commit 12b66fb8a9
9 changed files with 70 additions and 423 deletions

View File

@ -60,7 +60,7 @@
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
$select_lang = '<select name="select_lang">'; $select_lang = '<select name="select_lang">';
$GLOBALS['phpgw']->db->query("SELECT lang,languages.lang_name,languages.lang_id FROM lang,languages WHERE " $GLOBALS['phpgw']->db->query("SELECT lang,languages.lang_name,languages.lang_id FROM phpgw_lang,phpgw_languages WHERE "
. "lang.lang=languages.lang_id GROUP BY lang,languages.lang_name," . "lang.lang=languages.lang_id GROUP BY lang,languages.lang_name,"
. "languages.lang_id ORDER BY lang"); . "languages.lang_id ORDER BY lang");
while ($GLOBALS['phpgw']->db->next_record()) while ($GLOBALS['phpgw']->db->next_record())

View File

@ -56,7 +56,7 @@
{ {
$userlang = 'en'; $userlang = 'en';
} }
$sql = "SELECT message_id,content FROM lang WHERE lang LIKE '" . $userlang $sql = "SELECT message_id,content FROM phpgw_lang WHERE lang LIKE '" . $userlang
. "' AND (app_name LIKE '" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "' AND (app_name LIKE '" . $GLOBALS['phpgw_info']['flags']['currentapp']
. "' OR app_name LIKE 'common' OR app_name LIKE 'all')"; . "' OR app_name LIKE 'common' OR app_name LIKE 'all')";
@ -109,7 +109,7 @@
{ {
$userlang = 'en'; $userlang = 'en';
} }
$sql = "SELECT message_id,content FROM lang WHERE lang LIKE '".$userlang."' AND app_name LIKE '".$app."'"; $sql = "SELECT message_id,content FROM phpgw_lang WHERE lang LIKE '".$userlang."' AND app_name LIKE '".$app."'";
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record(); $GLOBALS['phpgw']->db->next_record();
$count = $GLOBALS['phpgw']->db->num_rows(); $count = $GLOBALS['phpgw']->db->num_rows();

View File

@ -14,7 +14,7 @@
/* Basic information about this app */ /* Basic information about this app */
$setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'phpgwapi';
$setup_info['phpgwapi']['version'] = '0.9.15.001'; $setup_info['phpgwapi']['version'] = '0.9.15.002';
$setup_info['phpgwapi']['versions']['current_header'] = '1.20'; $setup_info['phpgwapi']['versions']['current_header'] = '1.20';
$setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['enable'] = 3;
$setup_info['phpgwapi']['app_order'] = 1; $setup_info['phpgwapi']['app_order'] = 1;
@ -30,8 +30,8 @@
$setup_info['phpgwapi']['tables'][] = 'phpgw_app_sessions'; $setup_info['phpgwapi']['tables'][] = 'phpgw_app_sessions';
$setup_info['phpgwapi']['tables'][] = 'phpgw_accounts'; $setup_info['phpgwapi']['tables'][] = 'phpgw_accounts';
$setup_info['phpgwapi']['tables'][] = 'phpgw_access_log'; $setup_info['phpgwapi']['tables'][] = 'phpgw_access_log';
$setup_info['phpgwapi']['tables'][] = 'lang'; $setup_info['phpgwapi']['tables'][] = 'phpgw_lang';
$setup_info['phpgwapi']['tables'][] = 'languages'; $setup_info['phpgwapi']['tables'][] = 'phpgw_languages';
$setup_info['phpgwapi']['tables'][] = 'phpgw_nextid'; $setup_info['phpgwapi']['tables'][] = 'phpgw_nextid';
$setup_info['phpgwapi']['tables'][] = 'phpgw_addressbook'; $setup_info['phpgwapi']['tables'][] = 'phpgw_addressbook';
$setup_info['phpgwapi']['tables'][] = 'phpgw_addressbook_extra'; $setup_info['phpgwapi']['tables'][] = 'phpgw_addressbook_extra';

View File

@ -136,7 +136,7 @@
'fk' => array(), 'fk' => array(),
'uc' => array() 'uc' => array()
), ),
'languages' => array( 'phpgw_languages' => array(
'fd' => array( 'fd' => array(
'lang_id' => array('type' => 'varchar', 'precision' => 2, 'nullable' => false), 'lang_id' => array('type' => 'varchar', 'precision' => 2, 'nullable' => false),
'lang_name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => false), 'lang_name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => false),
@ -147,7 +147,7 @@
'fk' => array(), 'fk' => array(),
'uc' => array() 'uc' => array()
), ),
'lang' => array( 'phpgw_lang' => array(
'fd' => array( 'fd' => array(
'message_id' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false, 'default' => ''), 'message_id' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false, 'default' => ''),
'app_name' => array('type' => 'varchar', 'precision' => 100, 'nullable' => false, 'default' => 'common'), 'app_name' => array('type' => 'varchar', 'precision' => 100, 'nullable' => false, 'default' => 'common'),

View File

@ -15,409 +15,30 @@
include($appdir . 'tables_update_0_9_9.inc.php'); include($appdir . 'tables_update_0_9_9.inc.php');
include($appdir . 'tables_update_0_9_10.inc.php'); include($appdir . 'tables_update_0_9_10.inc.php');
include($appdir . 'tables_update_0_9_12.inc.php'); include($appdir . 'tables_update_0_9_12.inc.php');
include($appdir . 'tables_update_0_9_14.inc.php');
/* This is since the last release */ /* This is since the last release */
$test[] = '0.9.12';
function phpgwapi_upgrade0_9_12()
{
global $setup_info,$phpgw_setup;
$setup_info['phpgwapi']['currentver'] = '0.9.13.001';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.001';
function phpgwapi_upgrade0_9_13_001()
{
global $setup_info,$phpgw_setup;
$phpgw_setup->oProc->AlterColumn('phpgw_categories','cat_access', array('type' => 'varchar', 'precision' => 7));
$setup_info['phpgwapi']['currentver'] = '0.9.13.002';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.002';
function phpgwapi_upgrade0_9_13_002()
{
global $setup_info,$phpgw_setup;
$phpgw_setup->oProc->AddColumn('phpgw_accounts','account_file_space', array ('type' => 'varchar', 'precision' => 25));
$setup_info['phpgwapi']['currentver'] = '0.9.13.003';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.003';
function phpgwapi_upgrade0_9_13_003()
{
global $setup_info,$phpgw_setup;
$phpgw_setup->oProc->AlterColumn('phpgw_access_log','sessionid',array('type' => 'char', 'precision' => 32));
$setup_info['phpgwapi']['currentver'] = '0.9.13.004';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.004';
function phpgwapi_upgrade0_9_13_004()
{
global $setup_info, $phpgw_setup, $phpgw_info, $phpgw;
$phpgw_setup->oProc->AddColumn('phpgw_access_log','account_id',array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => False));
class phpgw
{
var $common;
var $accounts;
var $applications;
var $db;
}
$phpgw = new phpgw;
$phpgw->common = CreateObject('phpgwapi.common');
$phpgw_setup->oProc->query("SELECT config_name,config_value FROM phpgw_config WHERE config_name LIKE 'ldap%' OR config_name='account_repository'",__LINE__,__FILE__);
while ($phpgw_setup->oProc->next_record())
{
$config[$phpgw_setup->oProc->f('config_name')] = $phpgw_setup->oProc->f('config_value');
}
$phpgw_info['server']['ldap_host'] = $config['ldap_host'];
$phpgw_info['server']['ldap_context'] = $config['ldap_context'];
$phpgw_info['server']['ldap_group_context'] = $config['ldap_group_context'];
$phpgw_info['server']['ldap_root_dn'] = $config['ldap_root_dn'];
$phpgw_info['server']['ldap_root_pw'] = $config['ldap_root_pw'];
$phpgw_info['server']['account_repository'] = $config['account_repository'];
$accounts = CreateObject('phpgwapi.accounts');
$accounts->db = $phpgw_setup->db;
$phpgw_setup->oProc->query("select * from phpgw_access_log");
while ($phpgw_setup->oProc->next_record())
{
$lid = explode('@',$phpgw_setup->oProc->f('loginid'));
$account_lid = $lid[0];
$account_id = $accounts->name2id($account_lid);
$phpgw_setup->db->query("update phpgw_access_log set account_id='" . $account_id
. "' where sessionid='" . $phpgw_setup->oProc->f('sessionid') . "'");
}
$setup_info['phpgwapi']['currentver'] = '0.9.13.005';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.005';
function phpgwapi_upgrade0_9_13_005()
{
global $setup_info, $phpgw_setup;
$newtbldef = array(
'fd' => array(
'account_id' => array('type' => 'auto', 'nullable' => false),
'account_lid' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
'account_pwd' => array('type' => 'varchar', 'precision' => 32, 'nullable' => false),
'account_firstname' => array('type' => 'varchar', 'precision' => 50),
'account_lastname' => array('type' => 'varchar', 'precision' => 50),
'account_permissions' => array('type' => 'text'),
'account_groups' => array('type' => 'varchar', 'precision' => 30),
'account_lastlogin' => array('type' => 'int', 'precision' => 4),
'account_lastloginfrom' => array('type' => 'varchar', 'precision' => 255),
'account_lastpwd_change' => array('type' => 'int', 'precision' => 4),
'account_status' => array('type' => 'char', 'precision' => 1, 'nullable' => false, 'default' => 'A'),
'account_expires' => array('type' => 'int', 'precision' => 4),
'account_type' => array('type' => 'char', 'precision' => 1, 'nullable' => true)
),
'pk' => array('account_id'),
'fk' => array(),
'ix' => array(),
'uc' => array('account_lid')
);
$phpgw_setup->oProc->DropColumn('phpgw_accounts',$newtbldef,'account_file_space');
$setup_info['phpgwapi']['currentver'] = '0.9.13.006';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.006';
function phpgwapi_upgrade0_9_13_006()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->CreateTable(
'phpgw_log', array(
'fd' => array(
'log_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False),
'log_date' => array('type' => 'timestamp', 'nullable' => False),
'log_user' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_app' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False),
'log_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False)
),
'pk' => array('log_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$phpgw_setup->oProc->CreateTable(
'phpgw_log_msg', array(
'fd' => array(
'log_msg_log_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False),
'log_msg_seq_no' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_date' => array('type' => 'timestamp', 'nullable' => False),
'log_msg_tx_fid' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True),
'log_msg_tx_id' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True),
'log_msg_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False),
'log_msg_code' => array('type' => 'varchar', 'precision' => 30, 'nullable' => False),
'log_msg_msg' => array('type' => 'text', 'nullable' => False),
'log_msg_parms' => array('type' => 'text', 'nullable' => False)
),
'pk' => array('log_msg_log_id', 'log_msg_seq_no'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$setup_info['phpgwapi']['currentver'] = '0.9.13.007';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.007';
function phpgwapi_upgrade0_9_13_007()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->AlterColumn('phpgw_log_msg','log_msg_log_id',array('type' => 'int', 'precision' => 4, 'nullable'=> False));
$setup_info['phpgwapi']['currentver'] = '0.9.13.008';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.008';
function phpgwapi_upgrade0_9_13_008()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->AddColumn('phpgw_log_msg','log_msg_file',array('type' => 'varchar', 'precision' => 255, 'nullable'=> False));
$phpgw_setup->oProc->AddColumn('phpgw_log_msg','log_msg_line',array('type' => 'int', 'precision' => 4, 'nullable'=> False));
$setup_info['phpgwapi']['currentver'] = '0.9.13.009';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.009';
function phpgwapi_upgrade0_9_13_009()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->CreateTable(
'phpgw_interserv', array(
'fd' => array(
'server_id' => array('type' => 'auto', 'nullable' => False),
'server_name' => array('type' => 'varchar', 'precision' => 64, 'nullable' => True),
'server_host' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
'server_url' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
'trust_level' => array('type' => 'int', 'precision' => 4),
'trust_rel' => array('type' => 'int', 'precision' => 4),
'username' => array('type' => 'varchar', 'precision' => 64, 'nullable' => True),
'password' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
'admin_name' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
'admin_email' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
'server_mode' => array('type' => 'varchar', 'precision' => 16, 'nullable' => False, 'default' => 'xmlrpc'),
'server_security' => array('type' => 'varchar', 'precision' => 16,'nullable' => True)
),
'pk' => array('server_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$setup_info['phpgwapi']['currentver'] = '0.9.13.010';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.010';
function phpgwapi_upgrade0_9_13_010()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->AlterColumn('phpgw_sessions','session_lid',array('type' => 'varchar', 'precision' => 255, 'nullable'=> False));
$setup_info['phpgwapi']['currentver'] = '0.9.13.011';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.011';
function phpgwapi_upgrade0_9_13_011()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->CreateTable(
'phpgw_vfs', array(
'fd' => array(
'file_id' => array('type' => 'auto','nullable' => False),
'owner_id' => array('type' => 'int', 'precision' => 4,'nullable' => False),
'createdby_id' => array('type' => 'int', 'precision' => 4,'nullable' => True),
'modifiedby_id' => array('type' => 'int', 'precision' => 4,'nullable' => True),
'created' => array('type' => 'date','nullable' => False,'default' => '1970-01-01'),
'modified' => array('type' => 'date','nullable' => True),
'size' => array('type' => 'int', 'precision' => 4,'nullable' => True),
'mime_type' => array('type' => 'varchar', 'precision' => 150,'nullable' => True),
'deleteable' => array('type' => 'char', 'precision' => 1,'nullable' => True,'default' => 'Y'),
'comment' => array('type' => 'text','nullable' => True),
'app' => array('type' => 'varchar', 'precision' => 25,'nullable' => True),
'directory' => array('type' => 'text','nullable' => True),
'name' => array('type' => 'text','nullable' => False),
'link_directory' => array('type' => 'text','nullable' => True),
'link_name' => array('type' => 'text','nullable' => True),
'version' => array('type' => 'varchar', 'precision' => 30,'nullable' => False,'default' => '0.0.0.0')
),
'pk' => array('file_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$setup_info['phpgwapi']['currentver'] = '0.9.13.012';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.012';
function phpgwapi_upgrade0_9_13_012()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->AlterColumn('phpgw_applications', 'app_tables', array('type' => 'text'));
$setup_info['phpgwapi']['currentver'] = '0.9.13.013';
return $setup_info['phpgwapi']['currentver'];
}
$test[] = '0.9.13.013';
function phpgwapi_upgrade0_9_13_013()
{
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'phpgw_history_log', array(
'fd' => array(
'history_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False),
'history_record_id' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'history_appname' => array('type' => 'varchar', 'precision' => 64, 'nullable' => False),
'history_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'history_status' => array('type' => 'char', 'precision' => 2, 'nullable' => False),
'history_new_value' => array('type' => 'text', 'nullable' => False),
'history_timestamp' => array('type' => 'timestamp', 'nullable' => False, 'default' => 'current_timestamp')
),
'pk' => array('history_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.014';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
$test[] = '0.9.13.014';
function phpgwapi_upgrade0_9_13_014()
{
$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_applications SET app_order=100 WHERE app_order IS NULL");
$GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_applications");
while ($GLOBALS['phpgw_setup']->oProc->next_record())
{
$app_name[] = $GLOBALS['phpgw_setup']->oProc->f('app_name');
$app_title[] = $GLOBALS['phpgw_setup']->oProc->f('app_title');
$app_enabled[] = $GLOBALS['phpgw_setup']->oProc->f('app_enabled');
$app_order[] = $GLOBALS['phpgw_setup']->oProc->f('app_order');
$app_tables[] = $GLOBALS['phpgw_setup']->oProc->f('app_tables');
$app_version[] = $GLOBALS['phpgw_setup']->oProc->f('app_version');
}
$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_applications');
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'phpgw_applications', array(
'fd' => array(
'app_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => false),
'app_name' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
'app_title' => array('type' => 'varchar', 'precision' => 50),
'app_enabled' => array('type' => 'int', 'precision' => 4),
'app_order' => array('type' => 'int', 'precision' => 4),
'app_tables' => array('type' => 'varchar', 'precision' => 255),
'app_version' => array('type' => 'varchar', 'precision' => 20, 'nullable' => false, 'default' => '0.0')
),
'pk' => array('app_id'),
'fk' => array(),
'ix' => array(),
'uc' => array('app_name')
)
);
$rec_count = count($app_name);
for($rec_loop=0;$rec_loop<$rec_count;$rec_loop++)
{
$GLOBALS['phpgw_setup']->oProc->query('INSERT INTO phpgw_applications(app_id,app_name,app_title,app_enabled,app_order,app_tables,app_version) '
. 'VALUES('.($rec_loop + 1).",'".$app_name[$rec_loop]."','".$app_title[$rec_loop]."',".$app_enabled[$rec_loop].','.$app_order[$rec_loop].",'".$app_tables[$rec_loop]."','".$app_version[$rec_loop]."')");
}
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.015';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
$test[] = '0.9.13.015';
function phpgwapi_upgrade0_9_13_015()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn(
'lang',
'message_id',
array(
'type' => 'varchar',
'precision' => 255,
'nullable' => false,
'default' => ''
)
);
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.016';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
$test[] = '0.9.13.016';
function phpgwapi_upgrade0_9_13_016()
{
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','acl_manager','hook_acl_manager.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','add_def_pref','hook_add_def_pref.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','after_navbar','hook_after_navbar.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','deleteaccount','hook_deleteaccount.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','config','hook_config.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','manual','hook_manual.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','view_user','hook_view_user.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','admin_deleteaccount','hook_admin_deleteaccount.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','config','hook_config.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','manual','hook_manual.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','preferences','hook_preferences.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','settings','hook_settings.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','about','hook_about.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','add_def_pref','hook_add_def_pref.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','config_validate','hook_config_validate.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','deleteaccount','hook_deleteaccount.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','home','hook_home.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','manual','hook_manual.inc.php')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','notifywindow','hook_notifywindow.inc.php')");
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.017';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
$test[] = '0.9.13.017'; $test[] = '0.9.13.017';
function phpgwapi_upgrade0_9_13_017() function phpgwapi_upgrade0_9_13_017()
{ {
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.001'; $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.001';
return $GLOBALS['setup_info']['phpgwapi']['currentver']; return $GLOBALS['setup_info']['phpgwapi']['currentver'];
} }
$test[] = '0.9.14';
function phpgwapi_upgrade0_9_14()
{
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.001';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
$test[] = '0.9.15.001';
function phpgwapi_upgrade0_9_15_001()
{
$GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang');
$GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages');
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.002';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
?> ?>

View File

@ -66,12 +66,12 @@
create_select_box('Country','country',$sbox->country_array); create_select_box('Country','country',$sbox->country_array);
$db2 = $GLOBALS['phpgw']->db; $db2 = $GLOBALS['phpgw']->db;
$GLOBALS['phpgw']->db->query("select distinct lang from lang",__LINE__,__FILE__); $GLOBALS['phpgw']->db->query("select distinct lang from phpgw_lang",__LINE__,__FILE__);
while ($GLOBALS['phpgw']->db->next_record()) while ($GLOBALS['phpgw']->db->next_record())
{ {
// $phpgw_info['installed_langs'][$phpgw->db->f('lang')] = $phpgw->db->f('lang'); // $phpgw_info['installed_langs'][$phpgw->db->f('lang')] = $phpgw->db->f('lang');
$db2->query("select lang_name from languages where lang_id = '" $db2->query("select lang_name from phpgw_languages where lang_id = '"
. $GLOBALS['phpgw']->db->f('lang') . "'",__LINE__,__FILE__); . $GLOBALS['phpgw']->db->f('lang') . "'",__LINE__,__FILE__);
$db2->next_record(); $db2->next_record();

View File

@ -316,12 +316,23 @@
function check_lang() function check_lang()
{ {
$this->db->Halt_On_Error = 'no'; $this->db->Halt_On_Error = 'no';
if ($GLOBALS['phpgw_info']['setup']['stage']['db'] != 10) if($GLOBALS['phpgw_info']['setup']['stage']['db'] != 10)
{ {
return ''; return '';
} }
$this->db->query("select distinct lang from lang;"); if($this->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.15.002'))
{
$langtbl = 'lang';
$langstbl = 'languages';
}
else
{
$langtbl = 'phpgw_lang';
$langstbl = 'phpgw_languages';
}
$this->db->query("SELECT DISTINCT lang FROM $langtbl",__LINE__,__FILE__);
if ($this->db->num_rows() == 0) if ($this->db->num_rows() == 0)
{ {
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 3 (No languages installed)'; $GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 3 (No languages installed)';
@ -329,14 +340,14 @@
} }
else else
{ {
while (@$this->db->next_record()) while(@$this->db->next_record())
{ {
$GLOBALS['phpgw_info']['setup']['installed_langs'][$this->db->f('lang')] = $this->db->f('lang'); $GLOBALS['phpgw_info']['setup']['installed_langs'][$this->db->f('lang')] = $this->db->f('lang');
} }
reset ($GLOBALS['phpgw_info']['setup']['installed_langs']); reset($GLOBALS['phpgw_info']['setup']['installed_langs']);
while (list ($key, $value) = each ($GLOBALS['phpgw_info']['setup']['installed_langs'])) while(list($key, $value) = each($GLOBALS['phpgw_info']['setup']['installed_langs']))
{ {
$sql = "select lang_name from languages where lang_id = '".$value."';"; $sql = "SELECT lang_name FROM $langstbl WHERE lang_id = '".$value."';";
$this->db->query($sql); $this->db->query($sql);
$this->db->next_record(); $this->db->next_record();
$GLOBALS['phpgw_info']['setup']['installed_langs'][$value] = $this->db->f('lang_name'); $GLOBALS['phpgw_info']['setup']['installed_langs'][$value] = $this->db->f('lang_name');

View File

@ -26,6 +26,7 @@
class phpgw_setup_lang extends phpgw_setup_process class phpgw_setup_lang extends phpgw_setup_process
{ {
var $langarray; var $langarray;
var $langtbl = 'phpgw_lang';
/*! /*!
@function setup_lang @function setup_lang
@ -36,6 +37,11 @@
{ {
$ConfigLang = @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] ? @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] : @$GLOBALS['HTTP_POST_VARS']['ConfigLang']; $ConfigLang = @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] ? @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] : @$GLOBALS['HTTP_POST_VARS']['ConfigLang'];
if($this->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.15.002'))
{
$this->langtbl = 'lang';
}
if(!$ConfigLang) if(!$ConfigLang)
{ {
$lang = 'en'; $lang = 'en';
@ -119,7 +125,7 @@
{ {
echo '<br>get_langs(): checking db...' . "\n"; echo '<br>get_langs(): checking db...' . "\n";
} }
$GLOBALS['phpgw_setup']->db->query("SELECT DISTINCT(lang) FROM lang",__LINE__,__FILE__); $GLOBALS['phpgw_setup']->db->query("SELECT DISTINCT(lang) FROM $this->langtbl",__LINE__,__FILE__);
$langs = array(); $langs = array();
while($GLOBALS['phpgw_setup']->db->next_record()) while($GLOBALS['phpgw_setup']->db->next_record())
@ -144,11 +150,11 @@
{ {
echo '<br>drop_langs(): Working on: ' . $appname; echo '<br>drop_langs(): Working on: ' . $appname;
} }
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(message_id) FROM lang WHERE app_name='$appname'",__LINE__,__FILE__); $GLOBALS['phpgw_setup']->db->query("SELECT COUNT(message_id) FROM $this->langtbl WHERE app_name='$appname'",__LINE__,__FILE__);
$GLOBALS['phpgw_setup']->db->next_record(); $GLOBALS['phpgw_setup']->db->next_record();
if($GLOBALS['phpgw_setup']->db->f(0)) if($GLOBALS['phpgw_setup']->db->f(0))
{ {
$GLOBALS['phpgw_setup']->db->query("DELETE FROM lang WHERE app_name='$appname'",__LINE__,__FILE__); $GLOBALS['phpgw_setup']->db->query("DELETE FROM $this->langtbl WHERE app_name='$appname'",__LINE__,__FILE__);
return True; return True;
} }
return False; return False;
@ -199,7 +205,7 @@
$GLOBALS['phpgw_setup']->db_lang = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($GLOBALS['phpgw_setup']->db_lang)); $GLOBALS['phpgw_setup']->db_lang = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($GLOBALS['phpgw_setup']->db_lang));
$content = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($content)); $content = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($content));
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM lang WHERE message_id='$message_id' and lang='" $GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM $this->langtbl WHERE message_id='$message_id' and lang='"
. $GLOBALS['phpgw_setup']->db_lang . "'",__LINE__,__FILE__); . $GLOBALS['phpgw_setup']->db_lang . "'",__LINE__,__FILE__);
$GLOBALS['phpgw_setup']->db->next_record(); $GLOBALS['phpgw_setup']->db->next_record();
@ -209,9 +215,9 @@
{ {
if($DEBUG) if($DEBUG)
{ {
echo "<br>add_langs(): adding - INSERT INTO lang VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')"; echo "<br>add_langs(): adding - INSERT INTO $this->langtbl VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')";
} }
$GLOBALS['phpgw_setup']->db->query("INSERT INTO lang VALUES ('$message_id','$app_name','" $GLOBALS['phpgw_setup']->db->query("INSERT INTO $this->langtbl VALUES ('$message_id','$app_name','"
. $GLOBALS['phpgw_setup']->db_lang . "','$content')",__LINE__,__FILE__); . $GLOBALS['phpgw_setup']->db_lang . "','$content')",__LINE__,__FILE__);
} }
} }

View File

@ -42,6 +42,15 @@
$submit = True; $submit = True;
} }
if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'], '0.9.15.002'))
{
$langtbl = 'lang';
}
else
{
$langtbl = 'phpgw_lang';
}
if ($HTTP_POST_VARS['submit']) if ($HTTP_POST_VARS['submit'])
{ {
$lang_selected = $HTTP_POST_VARS['lang_selected']; $lang_selected = $HTTP_POST_VARS['lang_selected'];
@ -61,7 +70,7 @@
if ($upgrademethod == 'addonlynew') if ($upgrademethod == 'addonlynew')
{ {
//echo "<br>Test: addonlynew - select count(*) from lang where lang='$lang'"; //echo "<br>Test: addonlynew - select count(*) from lang where lang='$lang'";
$phpgw_setup->db->query("SELECT COUNT(*) FROM lang WHERE lang='$lang'",__LINE__,__FILE__); $phpgw_setup->db->query("SELECT COUNT(*) FROM $langtbl WHERE lang='$lang'",__LINE__,__FILE__);
$phpgw_setup->db->next_record(); $phpgw_setup->db->next_record();
if ($phpgw_setup->db->f(0) == 0) if ($phpgw_setup->db->f(0) == 0)
@ -102,7 +111,7 @@
if ($upgrademethod == 'addmissing') if ($upgrademethod == 'addmissing')
{ {
//echo '<br>Test: addmissing'; //echo '<br>Test: addmissing';
$phpgw_setup->db->query("SELECT COUNT(*) FROM lang WHERE message_id='$message_id' and lang='$phpgw_setup->db_lang'",__LINE__,__FILE__); $phpgw_setup->db->query("SELECT COUNT(*) FROM $langtbl WHERE message_id='$message_id' and lang='$phpgw_setup->db_lang'",__LINE__,__FILE__);
$phpgw_setup->db->next_record(); $phpgw_setup->db->next_record();
if ($phpgw_setup->db->f(0) == 0) if ($phpgw_setup->db->f(0) == 0)
@ -116,8 +125,8 @@
{ {
if($message_id && $content) if($message_id && $content)
{ {
// echo "<br>adding - insert into lang values ('$message_id','$app_name','$phpgw_setup->db_lang','$content')"; // echo "<br>adding - insert into $langtbl values ('$message_id','$app_name','$phpgw_setup->db_lang','$content')";
$phpgw_setup->db->query("INSERT into lang VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')",__LINE__,__FILE__); $phpgw_setup->db->query("INSERT into $langtbl VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')",__LINE__,__FILE__);
} }
} }
} }