r277: Finishing Beta 1
[bugdar.git] / docs / lang_file_import.php
1 <?php
2
3 // takes the locale/en.php file and loads it into the database language system
4 // SVN: $Id$
5
6 chdir('./../');
7
8 require_once('./global.php');
9
10 if (empty($_REQUEST['do']))
11 {
12 echo "are you sure? <a href=\"lang_file_import.php?do=1\">yes</a>";
13 }
14
15 if ($_REQUEST['do'] == 1)
16 {
17 $db->query("TRUNCATE TABLE " . TABLE_PREFIX . "phrase");
18
19 $sql = "
20 INSERT INTO " . TABLE_PREFIX . "phrase
21 (varname, phrasetext, imported)
22 VALUES";
23
24
25 require('./docs/lang_file_master.php');
26
27 foreach ($language AS $varname => $phrase)
28 {
29 $sqlbits[] = "
30 ('" . $bugsys->escape($varname) . "', '" . $bugsys->escape($phrase) . "', " . time() . ")";
31 }
32
33 $sql .= implode(',', $sqlbits);
34
35 echo "<pre>$sql</pre>";
36
37 $db->query($sql);
38 }
39
40 ?>