Jump to ContentJump to Navigation/Login
` ` ` ` ` `

[Register]

Occasional ATutor release updates


No Members Logged In

(3 guests in past 15 min.)

Access Understanding Web Accessibility to learn about accessibility, or Register to take the course for FREE.

Support Forums

ATutor Bug Reports

import_lang.php have error codes?


You must be signed-in to post.

AuthorSubject
  Page: 1
fang
Subject: import_lang.php have error codes?Quote this post in your reply
I installed Atutor 1.4.2 in XP system.
When I imported Taiwanese language package, I got import failure message. Then, I read this forum finding some hints. Try again. And still cannot import language package.
Finally, I traced the code in import_lang.php
----------------- Original code (Partial) -------------------------
while ($data = fgetcsv($fp, 10000000, ',')) {
if ($sql == '') {
/* first row stuff */
$sql = 'INSERT INTO '.TABLE_PREFIX.'lang2 VALUES ';
}
$sql .="('".$data[0]."', ";
$sql .="'".$data[1]."', ";
$sql .="'".$data[2]."', ";
$sql .="'".addslashes($data[3])."', ";
$sql .="'".$data[4]."'),";
}
if ($sql != '') {
$sql = substr($sql, 0, -1);
if (!mysql_query($sql, $db)){
require(AT_INCLUDE_PATH.'header.inc.php');
$errors[] = AT_ERROR_LANG_IMPORT_FAILED;
@unlink($import_path . 'language.csv');
print_errors($errors);
$_SESSION['done'] = 1;
require(AT_INCLUDE_PATH.'footer.inc.php');
exit;
}
}
---------------------------------------------------------------------------------

I changed it to the following:

---------------------- My changed code--------------------------
while ($data = fgetcsv($fp, 10000000, ',')) {
if ($sql == '') {
// first row stuff
$sql = 'INSERT INTO '.TABLE_PREFIX.'lang2 VALUES ';

}
$sql .="('".$data[0]."', ";
$sql .="'".$data[1]."', ";
$sql .="'".$data[2]."', ";
$sql .="'".addslashes($data[3])."', ";
$sql .="'".$data[4]."'),";

if ($sql != '') {
$sql = substr($sql, 0, -1);
}

mysql_query($sql, $db);

/* if (!mysql_query($sql, $db)){
require(AT_INCLUDE_PATH.'header.inc.php');
$errors[] = AT_ERROR_LANG_IMPORT_FAILED;
@unlink($import_path . 'language.csv');
print_errors($errors);
$_SESSION['done'] = 1;
require(AT_INCLUDE_PATH.'footer.inc.php');
exit;
} */
$sql = '';
}
--------------------------------------------------------------------------------

Yes, it imported corectly!

Is this a bug in import_lang.php?
Posted: 2004-10-24 11:18:07
greg

Avatar for greg
Subject: Apache versionQuote this post in your reply
I can not reproduce this problem on my XP system.

What version of Apache are you using?
Posted: 2004-10-24 12:36:32
fang
Subject: Apache VersionQuote this post in your reply
My system is :

Windows XP SP2

AppServ Version 2.5.1 for Windows
AppServ is a merging open source software installer package for Windows includes :

1.Apache Web Server Version 1.3.31

2.PHP Script Language Version 5.0.1

3.MySQL Database Version 4.0.20

4.Zend Optimizer Version 2.5.3

5.phpMyAdmin Database Manager Version 2.6.0-rc1

Thanks.
Posted: 2004-10-24 15:37:06
 Page: 1

You must be signed-in to post.