r394: Add access keys to the checkboxes
[bugdar.git] / docs / lang_registry_converter.php
1 <?php
2
3 // converts the language registry to phrases
4 // $Id$
5
6 chdir('./../');
7 require_once('./global.php');
8
9 ?>
10 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
12 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13 <head>
14 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
15 <title>Phrase Registry Converter</title>
16 </head>
17 <body>
18
19 <h2>Phrase Registry Converter</h2>
20
21 Pick a phrase from the phrase registry and enter in a varname and a comment (optional). The converter will remove it from the phrase registry and add it to the language system. It will also fill in the md5 field and comment field in the language system.
22
23 <br />
24 <br />
25
26 <?php
27
28 if ($bugsys->in['do'] == 'convert')
29 {
30 foreach ($bugsys->in['phrases'] AS $md5 => $phrase)
31 {
32 if ($phrase['varname'] AND $phrase['phrasetext'])
33 {
34 $db->query("
35 REPLACE INTO phrase
36 (varname, phrasetext, md5, comment)
37 VALUES
38 ('" . $phrase['varname'] . "',
39 '" . $phrase['phrasetext'] . "',
40 '" . $md5 . "',
41 '" . $phrase['comment'] . "'
42 )"
43 );
44
45 $db->query("DELETE FROM phraseregistry WHERE md5 = '" . $md5 . "'");
46 }
47 }
48
49 echo 'Converted phrase registry items. <a href="lang_registry_converter.php">Continue...</a>';
50 exit;
51 }
52
53 ?>
54
55 <form action="lang_registry_converter.php" method="post" name="converter">
56 <input name="do" type="hidden" value="convert" />
57
58 <table border="1" cellspacing="2" cellpadding="4" width="100%">
59 <thead>
60 <tr style="background-color: #EFEFEF">
61 <td>Phrase Text</td>
62 <td>Varname</td>
63 <td>Comment</td>
64 </tr>
65 </thead>
66 <tbody>
67 <?php
68
69 $registry = $db->query("SELECT * FROM phraseregistry");
70 while ($phrase = $db->fetch_array($registry))
71 {
72 $phrase['text_clean'] = htmlspecialchars($phrase['phrasetext']);
73
74 echo <<<HTML
75 <tr>
76 <td><input name="phrases[$phrase[md5]][phrasetext]" type="text" value="$phrase[text_clean]" style="width: 100%" /></td>
77 <td><input name="phrases[$phrase[md5]][varname]" type="text" style="width: 100%" /></td>
78 <td><input name="phrases[$phrase[md5]][comment]" type="text" style="width: 100%" /></td>
79 </tr>
80
81 HTML;
82 }
83
84 ?>
85 <tr style="background-color: #696969; text-align: center">
86 <td colspan="3"><input name="submit" type="submit" value=" Convert Registry Items " /></td>
87 </tr>
88 </tbody>
89 </table>
90
91 </form>
92
93 </body>
94 </html>