@@ -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 | } |