@@ -39,170 +39,170 @@ discard block |
||
39 | 39 | |
40 | 40 | switch ($ajax_action) { |
41 | 41 | |
42 | - case 'save_page_buffer': |
|
43 | - /** |
|
42 | + case 'save_page_buffer': |
|
43 | + /** |
|
44 | 44 | * Build language variable definitions |
45 | 45 | * @todo Change input handling using PMF_Filter |
46 | 46 | */ |
47 | - foreach ((array)@$_POST['PMF_LANG'] as $key => $val) { |
|
47 | + foreach ((array)@$_POST['PMF_LANG'] as $key => $val) { |
|
48 | 48 | |
49 | - if (is_string($val)) { |
|
50 | - $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val); |
|
51 | - $val = str_replace("'", "\\'", $val); |
|
52 | - $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key]"] = $val; |
|
53 | - } elseif (is_array($val)) { |
|
54 | - /** |
|
49 | + if (is_string($val)) { |
|
50 | + $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val); |
|
51 | + $val = str_replace("'", "\\'", $val); |
|
52 | + $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key]"] = $val; |
|
53 | + } elseif (is_array($val)) { |
|
54 | + /** |
|
55 | 55 | * Here we deal with a two dimensional array |
56 | 56 | */ |
57 | - foreach ($val as $key2 => $val2) { |
|
58 | - $val2 = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val2); |
|
59 | - $val2 = str_replace("'", "\\'", $val2); |
|
60 | - $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key][$key2]"] = $val2; |
|
57 | + foreach ($val as $key2 => $val2) { |
|
58 | + $val2 = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val2); |
|
59 | + $val2 = str_replace("'", "\\'", $val2); |
|
60 | + $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key][$key2]"] = $val2; |
|
61 | + } |
|
61 | 62 | } |
62 | 63 | } |
63 | - } |
|
64 | 64 | |
65 | - foreach ((array)@$_POST['LANG_CONF'] as $key => $val) { |
|
66 | - // if string like array(blah-blah-blah), extract the contents inside the brackets |
|
67 | - if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/',$val,$matches1)) { |
|
68 | - // split the resulting string of delimiters such as "number =>" |
|
69 | - $valArr = preg_split( |
|
70 | - '/\s*(\d+)\s*\=\>\s*/', |
|
71 | - $matches1[1], |
|
72 | - null, |
|
73 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
74 | - ); |
|
75 | - // in an array $valArr contents like "number substring", "substring", "number substring", "substring", ... |
|
76 | - $numVal = count($valArr); |
|
77 | - if ($numVal > 1) { |
|
78 | - $newValArr = array(); |
|
79 | - for ($i = 0; $i < $numVal; $i += 2) { |
|
80 | - if (is_numeric($valArr[$i])) { |
|
81 | - // clearing quotes |
|
82 | - if (preg_match('/^\s*\\\\*[\"|\'](.+)\\\\*[\"|\'][\s\,]*$/', $valArr[$i + 1], $matches2)) { |
|
83 | - $subVal = $matches2[1]; |
|
84 | - // normalize quotes |
|
85 | - $subVal = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $subVal); |
|
86 | - $subVal = str_replace("'", "\\'", $subVal); |
|
87 | - // assembly of the original substring back |
|
88 | - $newValArr[] = $valArr[$i].' => \''.$subVal.'\''; |
|
65 | + foreach ((array)@$_POST['LANG_CONF'] as $key => $val) { |
|
66 | + // if string like array(blah-blah-blah), extract the contents inside the brackets |
|
67 | + if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/',$val,$matches1)) { |
|
68 | + // split the resulting string of delimiters such as "number =>" |
|
69 | + $valArr = preg_split( |
|
70 | + '/\s*(\d+)\s*\=\>\s*/', |
|
71 | + $matches1[1], |
|
72 | + null, |
|
73 | + PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
74 | + ); |
|
75 | + // in an array $valArr contents like "number substring", "substring", "number substring", "substring", ... |
|
76 | + $numVal = count($valArr); |
|
77 | + if ($numVal > 1) { |
|
78 | + $newValArr = array(); |
|
79 | + for ($i = 0; $i < $numVal; $i += 2) { |
|
80 | + if (is_numeric($valArr[$i])) { |
|
81 | + // clearing quotes |
|
82 | + if (preg_match('/^\s*\\\\*[\"|\'](.+)\\\\*[\"|\'][\s\,]*$/', $valArr[$i + 1], $matches2)) { |
|
83 | + $subVal = $matches2[1]; |
|
84 | + // normalize quotes |
|
85 | + $subVal = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $subVal); |
|
86 | + $subVal = str_replace("'", "\\'", $subVal); |
|
87 | + // assembly of the original substring back |
|
88 | + $newValArr[] = $valArr[$i].' => \''.$subVal.'\''; |
|
89 | + } |
|
89 | 90 | } |
90 | 91 | } |
92 | + $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = 'array('.implode(", ",$newValArr).')'; |
|
91 | 93 | } |
92 | - $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = 'array('.implode(", ",$newValArr).')'; |
|
94 | + } else { // compatibility for old behavior |
|
95 | + $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val); |
|
96 | + $val = str_replace("'", "\\'", $val); |
|
97 | + $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = $val; |
|
93 | 98 | } |
94 | - } else { // compatibility for old behavior |
|
95 | - $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val); |
|
96 | - $val = str_replace("'", "\\'", $val); |
|
97 | - $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = $val; |
|
98 | 99 | } |
99 | - } |
|
100 | 100 | |
101 | - print 1; |
|
102 | - break; |
|
101 | + print 1; |
|
102 | + break; |
|
103 | 103 | |
104 | - case 'save_translated_lang': |
|
104 | + case 'save_translated_lang': |
|
105 | 105 | |
106 | - if (!$permission["edittranslation"]) { |
|
107 | - print $PMF_LANG['err_NotAuth']; |
|
108 | - exit; |
|
109 | - } |
|
106 | + if (!$permission["edittranslation"]) { |
|
107 | + print $PMF_LANG['err_NotAuth']; |
|
108 | + exit; |
|
109 | + } |
|
110 | 110 | |
111 | - $lang = strtolower($_SESSION['trans']['rightVarsOnly']["PMF_LANG[metaLanguage]"]); |
|
112 | - $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php"; |
|
111 | + $lang = strtolower($_SESSION['trans']['rightVarsOnly']["PMF_LANG[metaLanguage]"]); |
|
112 | + $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php"; |
|
113 | 113 | |
114 | - if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
115 | - print 0; |
|
116 | - exit; |
|
117 | - } |
|
114 | + if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
115 | + print 0; |
|
116 | + exit; |
|
117 | + } |
|
118 | 118 | |
119 | - if (!copy($filename, PMF_ROOT_DIR . "/lang/language_" . $lang . ".bak.php")) { |
|
120 | - print 0; |
|
121 | - exit; |
|
122 | - } |
|
119 | + if (!copy($filename, PMF_ROOT_DIR . "/lang/language_" . $lang . ".bak.php")) { |
|
120 | + print 0; |
|
121 | + exit; |
|
122 | + } |
|
123 | 123 | |
124 | - $newFileContents = ''; |
|
125 | - $tmpLines = array(); |
|
124 | + $newFileContents = ''; |
|
125 | + $tmpLines = array(); |
|
126 | 126 | |
127 | - // Read in the head of the file we're writing to |
|
128 | - $fh = fopen($filename, 'r'); |
|
129 | - do { |
|
130 | - $line = fgets($fh); |
|
131 | - array_push($tmpLines, rtrim($line)); |
|
132 | - } |
|
133 | - while ('*/' != substr(trim($line), -2)); |
|
134 | - fclose($fh); |
|
127 | + // Read in the head of the file we're writing to |
|
128 | + $fh = fopen($filename, 'r'); |
|
129 | + do { |
|
130 | + $line = fgets($fh); |
|
131 | + array_push($tmpLines, rtrim($line)); |
|
132 | + } |
|
133 | + while ('*/' != substr(trim($line), -2)); |
|
134 | + fclose($fh); |
|
135 | 135 | |
136 | - // Construct lines with variable definitions |
|
137 | - foreach ($_SESSION['trans']['rightVarsOnly'] as $key => $val) { |
|
138 | - if (0 === strpos($key, 'PMF_LANG')) { |
|
139 | - $val = "'$val'"; |
|
136 | + // Construct lines with variable definitions |
|
137 | + foreach ($_SESSION['trans']['rightVarsOnly'] as $key => $val) { |
|
138 | + if (0 === strpos($key, 'PMF_LANG')) { |
|
139 | + $val = "'$val'"; |
|
140 | + } |
|
141 | + array_push($tmpLines, '$' . str_replace(array('[', ']'), array("['", "']"), $key) . " = $val;"); |
|
140 | 142 | } |
141 | - array_push($tmpLines, '$' . str_replace(array('[', ']'), array("['", "']"), $key) . " = $val;"); |
|
142 | - } |
|
143 | 143 | |
144 | - $newFileContents .= implode("\n", $tmpLines); |
|
144 | + $newFileContents .= implode("\n", $tmpLines); |
|
145 | 145 | |
146 | - unset($_SESSION['trans']); |
|
146 | + unset($_SESSION['trans']); |
|
147 | 147 | |
148 | - $retval = file_put_contents($filename, $newFileContents); |
|
149 | - print intval($retval); |
|
150 | - break; |
|
148 | + $retval = file_put_contents($filename, $newFileContents); |
|
149 | + print intval($retval); |
|
150 | + break; |
|
151 | 151 | |
152 | - case 'remove_lang_file': |
|
152 | + case 'remove_lang_file': |
|
153 | 153 | |
154 | - if (!$permission['deltranslation']) { |
|
155 | - print $PMF_LANG['err_NotAuth']; |
|
156 | - exit; |
|
157 | - } |
|
154 | + if (!$permission['deltranslation']) { |
|
155 | + print $PMF_LANG['err_NotAuth']; |
|
156 | + exit; |
|
157 | + } |
|
158 | 158 | |
159 | - $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING); |
|
159 | + $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING); |
|
160 | 160 | |
161 | - if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
162 | - print 0; |
|
163 | - exit; |
|
164 | - } |
|
161 | + if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
162 | + print 0; |
|
163 | + exit; |
|
164 | + } |
|
165 | 165 | |
166 | - if (!copy(PMF_ROOT_DIR . "/lang/language_$lang.php", PMF_ROOT_DIR . "/lang/language_$lang.bak.php")) { |
|
167 | - print 0; |
|
168 | - exit; |
|
169 | - } |
|
166 | + if (!copy(PMF_ROOT_DIR . "/lang/language_$lang.php", PMF_ROOT_DIR . "/lang/language_$lang.bak.php")) { |
|
167 | + print 0; |
|
168 | + exit; |
|
169 | + } |
|
170 | 170 | |
171 | - if (!unlink(PMF_ROOT_DIR . "/lang/language_$lang.php")) { |
|
172 | - print 0; |
|
173 | - exit; |
|
174 | - } |
|
171 | + if (!unlink(PMF_ROOT_DIR . "/lang/language_$lang.php")) { |
|
172 | + print 0; |
|
173 | + exit; |
|
174 | + } |
|
175 | 175 | |
176 | - print 1; |
|
177 | - break; |
|
176 | + print 1; |
|
177 | + break; |
|
178 | 178 | |
179 | - case 'save_added_trans': |
|
179 | + case 'save_added_trans': |
|
180 | 180 | |
181 | - if (!$permission["addtranslation"]) { |
|
182 | - print $PMF_LANG['err_NotAuth']; |
|
183 | - exit; |
|
184 | - } |
|
181 | + if (!$permission["addtranslation"]) { |
|
182 | + print $PMF_LANG['err_NotAuth']; |
|
183 | + exit; |
|
184 | + } |
|
185 | 185 | |
186 | - if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
187 | - print 0; |
|
188 | - exit; |
|
189 | - } |
|
186 | + if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
187 | + print 0; |
|
188 | + exit; |
|
189 | + } |
|
190 | 190 | |
191 | - $langCode = PMF_Filter::filterInput(INPUT_POST, 'translang', FILTER_SANITIZE_STRING); |
|
192 | - $langName = @$languageCodes[$langCode]; |
|
193 | - $langCharset = "UTF-8"; |
|
194 | - $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING); |
|
195 | - $langNPlurals= strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1)); |
|
196 | - $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING); |
|
197 | - $author = (array) @$_POST['author']; |
|
191 | + $langCode = PMF_Filter::filterInput(INPUT_POST, 'translang', FILTER_SANITIZE_STRING); |
|
192 | + $langName = @$languageCodes[$langCode]; |
|
193 | + $langCharset = "UTF-8"; |
|
194 | + $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING); |
|
195 | + $langNPlurals= strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1)); |
|
196 | + $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING); |
|
197 | + $author = (array) @$_POST['author']; |
|
198 | 198 | |
199 | - if(empty($langCode) || empty($langName) || empty($langCharset) || |
|
200 | - empty($langDir) || empty($langDesc) || empty($author)) { |
|
201 | - print 0; |
|
202 | - exit; |
|
203 | - } |
|
199 | + if(empty($langCode) || empty($langName) || empty($langCharset) || |
|
200 | + empty($langDir) || empty($langDesc) || empty($author)) { |
|
201 | + print 0; |
|
202 | + exit; |
|
203 | + } |
|
204 | 204 | |
205 | - $fileTpl = <<<FILE |
|
205 | + $fileTpl = <<<FILE |
|
206 | 206 | <?php |
207 | 207 | /** |
208 | 208 | * %s |
@@ -228,41 +228,41 @@ discard block |
||
228 | 228 | \$PMF_LANG['nplurals'] = '%s'; |
229 | 229 | FILE; |
230 | 230 | |
231 | - $authorTpl = ''; |
|
232 | - foreach ($author as $authorData) { |
|
233 | - $authorTpl .= " * @author $authorData\n"; |
|
234 | - } |
|
231 | + $authorTpl = ''; |
|
232 | + foreach ($author as $authorData) { |
|
233 | + $authorTpl .= " * @author $authorData\n"; |
|
234 | + } |
|
235 | 235 | |
236 | - $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'), |
|
237 | - $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals); |
|
236 | + $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'), |
|
237 | + $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals); |
|
238 | 238 | |
239 | - $retval = @file_put_contents(PMF_ROOT_DIR . '/lang/language_' . strtolower($langCode) . '.php', $fileTpl); |
|
240 | - print intval($retval); |
|
241 | - break; |
|
239 | + $retval = @file_put_contents(PMF_ROOT_DIR . '/lang/language_' . strtolower($langCode) . '.php', $fileTpl); |
|
240 | + print intval($retval); |
|
241 | + break; |
|
242 | 242 | |
243 | 243 | |
244 | - case 'send_translated_file': |
|
244 | + case 'send_translated_file': |
|
245 | 245 | |
246 | - $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING); |
|
247 | - $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php"; |
|
246 | + $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING); |
|
247 | + $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php"; |
|
248 | 248 | |
249 | - if (!file_exists($filename)) { |
|
250 | - print 0; |
|
251 | - exit; |
|
252 | - } |
|
249 | + if (!file_exists($filename)) { |
|
250 | + print 0; |
|
251 | + exit; |
|
252 | + } |
|
253 | 253 | |
254 | - $letterTpl = ''; |
|
254 | + $letterTpl = ''; |
|
255 | 255 | |
256 | - $mail = new PMF_Mail($faqConfig); |
|
257 | - $mail->subject = 'New phpMyFAQ language file submitted'; |
|
258 | - $mail->message = sprintf('The file below was sent by %s, which is using phpMyFAQ %s on %s', |
|
259 | - $user->userdata->get('email'), |
|
260 | - $faqConfig->get('main.currentVersion'), |
|
261 | - $_SERVER['HTTP_HOST']); |
|
256 | + $mail = new PMF_Mail($faqConfig); |
|
257 | + $mail->subject = 'New phpMyFAQ language file submitted'; |
|
258 | + $mail->message = sprintf('The file below was sent by %s, which is using phpMyFAQ %s on %s', |
|
259 | + $user->userdata->get('email'), |
|
260 | + $faqConfig->get('main.currentVersion'), |
|
261 | + $_SERVER['HTTP_HOST']); |
|
262 | 262 | |
263 | - $mail->addTo('[email protected]'); |
|
264 | - $mail->addAttachment($filename, null, 'text/plain'); |
|
263 | + $mail->addTo('[email protected]'); |
|
264 | + $mail->addAttachment($filename, null, 'text/plain'); |
|
265 | 265 | |
266 | - print (int) $mail->send(); |
|
267 | - break; |
|
266 | + print (int) $mail->send(); |
|
267 | + break; |
|
268 | 268 | } |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | |
21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
22 | 22 | $protocol = 'http'; |
23 | - if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
23 | + if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
24 | 24 | $protocol = 'https'; |
25 | 25 | } |
26 | - header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); |
|
26 | + header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
|
27 | 27 | exit(); |
28 | 28 | } |
29 | 29 | |
30 | 30 | $ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING); |
31 | -$csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); |
|
31 | +$csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); |
|
32 | 32 | if (is_null($csrfToken)) { |
33 | - $csrfToken = PMF_Filter::filterInput(INPUT_GET, 'csrf', FILTER_SANITIZE_STRING); |
|
33 | + $csrfToken = PMF_Filter::filterInput(INPUT_GET, 'csrf', FILTER_SANITIZE_STRING); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if (is_string($val)) { |
50 | 50 | $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val); |
51 | 51 | $val = str_replace("'", "\\'", $val); |
52 | - $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key]"] = $val; |
|
52 | + $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key]"] = $val; |
|
53 | 53 | } elseif (is_array($val)) { |
54 | 54 | /** |
55 | 55 | * Here we deal with a two dimensional array |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ((array)@$_POST['LANG_CONF'] as $key => $val) { |
66 | 66 | // if string like array(blah-blah-blah), extract the contents inside the brackets |
67 | - if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/',$val,$matches1)) { |
|
67 | + if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/', $val, $matches1)) { |
|
68 | 68 | // split the resulting string of delimiters such as "number =>" |
69 | 69 | $valArr = preg_split( |
70 | 70 | '/\s*(\d+)\s*\=\>\s*/', |
71 | 71 | $matches1[1], |
72 | 72 | null, |
73 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
73 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
74 | 74 | ); |
75 | 75 | // in an array $valArr contents like "number substring", "substring", "number substring", "substring", ... |
76 | 76 | $numVal = count($valArr); |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | - $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = 'array('.implode(", ",$newValArr).')'; |
|
92 | + $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = 'array('.implode(", ", $newValArr).')'; |
|
93 | 93 | } |
94 | 94 | } else { // compatibility for old behavior |
95 | 95 | $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val); |
96 | 96 | $val = str_replace("'", "\\'", $val); |
97 | - $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = $val; |
|
97 | + $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = $val; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | $lang = strtolower($_SESSION['trans']['rightVarsOnly']["PMF_LANG[metaLanguage]"]); |
112 | - $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php"; |
|
112 | + $filename = PMF_ROOT_DIR."/lang/language_".$lang.".php"; |
|
113 | 113 | |
114 | - if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
114 | + if (!is_writable(PMF_ROOT_DIR."/lang")) { |
|
115 | 115 | print 0; |
116 | 116 | exit; |
117 | 117 | } |
118 | 118 | |
119 | - if (!copy($filename, PMF_ROOT_DIR . "/lang/language_" . $lang . ".bak.php")) { |
|
119 | + if (!copy($filename, PMF_ROOT_DIR."/lang/language_".$lang.".bak.php")) { |
|
120 | 120 | print 0; |
121 | 121 | exit; |
122 | 122 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if (0 === strpos($key, 'PMF_LANG')) { |
139 | 139 | $val = "'$val'"; |
140 | 140 | } |
141 | - array_push($tmpLines, '$' . str_replace(array('[', ']'), array("['", "']"), $key) . " = $val;"); |
|
141 | + array_push($tmpLines, '$'.str_replace(array('[', ']'), array("['", "']"), $key)." = $val;"); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $newFileContents .= implode("\n", $tmpLines); |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | |
159 | 159 | $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING); |
160 | 160 | |
161 | - if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
161 | + if (!is_writable(PMF_ROOT_DIR."/lang")) { |
|
162 | 162 | print 0; |
163 | 163 | exit; |
164 | 164 | } |
165 | 165 | |
166 | - if (!copy(PMF_ROOT_DIR . "/lang/language_$lang.php", PMF_ROOT_DIR . "/lang/language_$lang.bak.php")) { |
|
166 | + if (!copy(PMF_ROOT_DIR."/lang/language_$lang.php", PMF_ROOT_DIR."/lang/language_$lang.bak.php")) { |
|
167 | 167 | print 0; |
168 | 168 | exit; |
169 | 169 | } |
170 | 170 | |
171 | - if (!unlink(PMF_ROOT_DIR . "/lang/language_$lang.php")) { |
|
171 | + if (!unlink(PMF_ROOT_DIR."/lang/language_$lang.php")) { |
|
172 | 172 | print 0; |
173 | 173 | exit; |
174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | exit; |
184 | 184 | } |
185 | 185 | |
186 | - if (!is_writable(PMF_ROOT_DIR . "/lang")) { |
|
186 | + if (!is_writable(PMF_ROOT_DIR."/lang")) { |
|
187 | 187 | print 0; |
188 | 188 | exit; |
189 | 189 | } |
@@ -192,17 +192,17 @@ discard block |
||
192 | 192 | $langName = @$languageCodes[$langCode]; |
193 | 193 | $langCharset = "UTF-8"; |
194 | 194 | $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING); |
195 | - $langNPlurals= strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1)); |
|
195 | + $langNPlurals = strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1)); |
|
196 | 196 | $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING); |
197 | - $author = (array) @$_POST['author']; |
|
197 | + $author = (array)@$_POST['author']; |
|
198 | 198 | |
199 | - if(empty($langCode) || empty($langName) || empty($langCharset) || |
|
199 | + if (empty($langCode) || empty($langName) || empty($langCharset) || |
|
200 | 200 | empty($langDir) || empty($langDesc) || empty($author)) { |
201 | 201 | print 0; |
202 | 202 | exit; |
203 | 203 | } |
204 | 204 | |
205 | - $fileTpl = <<<FILE |
|
205 | + $fileTpl = <<<FILE |
|
206 | 206 | <?php |
207 | 207 | /** |
208 | 208 | * %s |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'), |
237 | 237 | $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals); |
238 | 238 | |
239 | - $retval = @file_put_contents(PMF_ROOT_DIR . '/lang/language_' . strtolower($langCode) . '.php', $fileTpl); |
|
239 | + $retval = @file_put_contents(PMF_ROOT_DIR.'/lang/language_'.strtolower($langCode).'.php', $fileTpl); |
|
240 | 240 | print intval($retval); |
241 | 241 | break; |
242 | 242 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | case 'send_translated_file': |
245 | 245 | |
246 | 246 | $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING); |
247 | - $filename = PMF_ROOT_DIR . "/lang/language_" . $lang . ".php"; |
|
247 | + $filename = PMF_ROOT_DIR."/lang/language_".$lang.".php"; |
|
248 | 248 | |
249 | 249 | if (!file_exists($filename)) { |
250 | 250 | print 0; |
@@ -263,6 +263,6 @@ discard block |
||
263 | 263 | $mail->addTo('[email protected]'); |
264 | 264 | $mail->addAttachment($filename, null, 'text/plain'); |
265 | 265 | |
266 | - print (int) $mail->send(); |
|
266 | + print (int)$mail->send(); |
|
267 | 267 | break; |
268 | 268 | } |