forked from pietrosperoni/Vilfredo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlanguage_admin.php
executable file
·143 lines (124 loc) · 2.84 KB
/
language_admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
require "config.inc.php";
header('Content-Type: text/html; charset=utf-8');
// Get user ID if logged in
$userid=isloggedin();
if (!$userid)
{
setError("You must be logged in to access this page.");
header("Location: error_page.php");
exit;
}
elseif (!isAdmin($userid))
{
setError("Only Administrators may access this page.");
header("Location: error_page.php");
exit;
}
require "lang_functions.php";
$lang = "en";
$table = 'vga_content';
$msg = '';
$filename = '';
$newfilename = '';
function showMessages($msg)
{
if (is_array($msg))
{
foreach ($msg as $m)
{
echo "<div class=\"message\">$m</div>";
}
}
else
{
echo "<div class=\"message\">$msg</div>";
}
}
if (isset($_POST['generate_dictionary_file']))
{
if($_POST['dictfilelang'] == 'it' or $_POST['dictfilelang'] == 'en')
{
$language = ($_POST['dictfilelang'] == 'en') ? "English" : "Italian";
if (generate_translation_file($_POST['dictfilelang'], $_POST['langfilename'] ))
{
$msg[] = "$language dictionary {$_POST['langfilename']} successfully created in lang/". LANG_FILES_DIRECTORY ." subdirectory!";
}
else
{
$msg[] = "ERROR! $language dictionary {$_POST['langfilename']} COULD NOT be created...";
}
}
}
?>
<style type="text/css">
table.admin {
width: 100%;
}
table.admin td {
padding: 10px;
text-align: center;
}
table.panel {
margin-top: 20px;
}
table.panel td, table.panel th {
padding: 5px;
}
.admin input:text {
width: 10px;
}
#generate_dictionary_file {
height: 30px;
width: 200px;
font-size: 0.9em;
margin-top: 5px;
background-color: #528b8b;
color: white;
}
#dictfilelang {
height: 30px;
font-size: 0.9em;
}
table.panel {
font-size: 1.1em;
}
.message {
font-size: 2em;
color: green;
}
.error {
font-size: 2em;
color: red;
font-weight: bold;
}
.intro {
font-size: 1.3em;
width: 600px;
background-color: #FFEFD5;
padding: 10px;
}
</style>
<p><a href='list_trans.php'>Back To Listing</a></p>
<h1>Manage Dictionary</h1>
<h2>Using table <?=$table?></h2>
<div class="intro">
<p>Select language 'en' or 'it' from from down then click button to create the language file in the lang/<?=LANG_FILES_DIRECTORY?> subdirectory from the database. The current file will be renamed with the current time and date as a backup.</p>
<p>Click "Back to listing" link at the top to return to the listing page.</p>
</div>
<p><?=showMessages($msg)?></p>
<form action="" method="POST" onsubmit=false>
<table class="panel">
<tr>
<td>Lang:
<select name="dictfilelang" id="dictfilelang">
<option value="en" 'selected'>en</option>
<option value="it">it</option>
</select>
</td>
<td>
<input type='submit' id="generate_dictionary_file" name='generate_dictionary_file' value='Generate Dictionary File' />
</td>
</tr>
</table>
</form>