@@ -82,13 +82,13 @@ |
||
82 | 82 | $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XHTML, $categoryId, $downwards, $language); |
83 | 83 | $version = $this->_config->get('main.currentVersion'); |
84 | 84 | $comment = sprintf('XHTML output by phpMyFAQ %s | Date: %s', |
85 | - $version, |
|
86 | - PMF_Date::createIsoDate(date('YmdHis'))); |
|
85 | + $version, |
|
86 | + PMF_Date::createIsoDate(date('YmdHis'))); |
|
87 | 87 | |
88 | 88 | $this->xml->startDocument('1.0', 'utf-8'); |
89 | 89 | $this->xml->writeDtd('html', |
90 | - '-//W3C//DTD XHTML 1.0 Transitional//EN', |
|
91 | - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'); |
|
90 | + '-//W3C//DTD XHTML 1.0 Transitional//EN', |
|
91 | + 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'); |
|
92 | 92 | $this->xml->startElement('html'); |
93 | 93 | $this->xml->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); |
94 | 94 | $this->xml->writeAttribute('xml:lang', $language); |
@@ -80,8 +80,8 @@ |
||
80 | 80 | $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XML, $categoryId, $downwards, $language); |
81 | 81 | $version = $this->_config->get('main.currentVersion'); |
82 | 82 | $comment = sprintf('XML output by phpMyFAQ %s | Date: %s', |
83 | - $version, |
|
84 | - PMF_Date::createIsoDate(date('YmdHis'))); |
|
83 | + $version, |
|
84 | + PMF_Date::createIsoDate(date('YmdHis'))); |
|
85 | 85 | |
86 | 86 | $this->xml->startDocument('1.0', 'utf-8', 'yes'); |
87 | 87 | $this->xml->writeComment($comment); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | WHERE |
217 | 217 | id = %d AND lang = '%s'", |
218 | 218 | PMF_Db::getTablePrefix(), |
219 | - (int) $id, |
|
219 | + (int)$id, |
|
220 | 220 | $this->config->getLanguage()->getLanguage() |
221 | 221 | ); |
222 | 222 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | PMF_Db::getTablePrefix(), |
292 | 292 | PMF_String::htmlspecialchars($this->item), |
293 | 293 | PMF_String::htmlspecialchars($this->definition), |
294 | - (int) $id, |
|
294 | + (int)$id, |
|
295 | 295 | $this->config->getLanguage()->getLanguage() |
296 | 296 | ); |
297 | 297 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | WHERE |
318 | 318 | id = %d AND lang = '%s'", |
319 | 319 | PMF_Db::getTablePrefix(), |
320 | - (int) $id, |
|
320 | + (int)$id, |
|
321 | 321 | $this->config->getLanguage()->getLanguage() |
322 | 322 | ); |
323 | 323 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $numFaqs = $this->Category->getNumberOfRecordsOfCategory(); |
54 | 54 | |
55 | 55 | if ($numCategories > 0) { |
56 | - for ($y = 0;$y < $numCategories; $y = $this->Category->getNextLineTree($y)) { |
|
56 | + for ($y = 0; $y < $numCategories; $y = $this->Category->getNextLineTree($y)) { |
|
57 | 57 | list($hasChild, $name, $categoryId, $description, $active) = $this->Category->getLineDisplay($y); |
58 | 58 | |
59 | 59 | if (!$active) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->Category->expandAll(); |
159 | 159 | |
160 | 160 | if ($numCategories > 0) { |
161 | - for ($y = 0;$y < $this->Category->height(); $y = $this->Category->getNextLineTree($y)) { |
|
161 | + for ($y = 0; $y < $this->Category->height(); $y = $this->Category->getNextLineTree($y)) { |
|
162 | 162 | list($hasChild, $categoryName, $parent, $description, $active) = $this->Category->getLineDisplay($y); |
163 | 163 | |
164 | 164 | if (!$active) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | { |
254 | 254 | $categories = ''; |
255 | 255 | foreach ($this->Category->categories as $cat) { |
256 | - if (0 === (int) $cat['parent_id']) { |
|
256 | + if (0 === (int)$cat['parent_id']) { |
|
257 | 257 | $categories .= sprintf( |
258 | 258 | '<li><a href="?action=show&cat=%d">%s</a></li>', |
259 | 259 | $cat['id'], |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | return $filename; |
139 | 139 | } |
140 | 140 | |
141 | - /** |
|
142 | - * Clean the filename of any uploaded file by the user and force an error |
|
143 | - * when calling is_uploaded_file($_FILES[key]['tmp_name']) if the cleanup goes wrong. |
|
144 | - */ |
|
145 | - private static function _cleanFilenames() |
|
146 | - { |
|
147 | - reset($_FILES); |
|
148 | - while (list($key, $value) = each($_FILES)) { |
|
149 | - if (is_array($_FILES[$key]['name'])) { |
|
150 | - reset($_FILES[$key]['name']); |
|
141 | + /** |
|
142 | + * Clean the filename of any uploaded file by the user and force an error |
|
143 | + * when calling is_uploaded_file($_FILES[key]['tmp_name']) if the cleanup goes wrong. |
|
144 | + */ |
|
145 | + private static function _cleanFilenames() |
|
146 | + { |
|
147 | + reset($_FILES); |
|
148 | + while (list($key, $value) = each($_FILES)) { |
|
149 | + if (is_array($_FILES[$key]['name'])) { |
|
150 | + reset($_FILES[$key]['name']); |
|
151 | 151 | // We have a multiple upload with the same name for <input /> |
152 | 152 | while (list($idx, $value2) = each($_FILES[$key]['name'])) { |
153 | 153 | $_FILES[$key]['name'][$idx] = self::_basicFilenameClean($_FILES[$key]['name'][$idx]); |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | $_FILES[$key]['error'][$idx] = UPLOAD_ERR_NO_FILE; |
159 | 159 | } |
160 | 160 | } |
161 | - reset($_FILES[$key]['name']); |
|
162 | - } else { |
|
163 | - $_FILES[$key]['name'] = self::_basicFilenameClean($_FILES[$key]['name']); |
|
164 | - if ('' == $_FILES[$key]['name']) { |
|
165 | - $_FILES[$key]['type'] = ''; |
|
166 | - $_FILES[$key]['tmp_name'] = ''; |
|
167 | - $_FILES[$key]['size'] = 0; |
|
168 | - $_FILES[$key]['error'] = UPLOAD_ERR_NO_FILE; |
|
169 | - } |
|
170 | - } |
|
171 | - } |
|
172 | - reset($_FILES); |
|
173 | - } |
|
161 | + reset($_FILES[$key]['name']); |
|
162 | + } else { |
|
163 | + $_FILES[$key]['name'] = self::_basicFilenameClean($_FILES[$key]['name']); |
|
164 | + if ('' == $_FILES[$key]['name']) { |
|
165 | + $_FILES[$key]['type'] = ''; |
|
166 | + $_FILES[$key]['tmp_name'] = ''; |
|
167 | + $_FILES[$key]['size'] = 0; |
|
168 | + $_FILES[$key]['error'] = UPLOAD_ERR_NO_FILE; |
|
169 | + } |
|
170 | + } |
|
171 | + } |
|
172 | + reset($_FILES); |
|
173 | + } |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Cleans a html string from some xss issues. |
@@ -783,7 +783,7 @@ |
||
783 | 783 | } |
784 | 784 | usleep(1000); |
785 | 785 | ++$count; |
786 | - if (!($count % 10)) { |
|
786 | + if (!($count%10)) { |
|
787 | 787 | echo '| '; |
788 | 788 | } |
789 | 789 | } |
@@ -2,8 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Symfony\Component\ClassLoader\Psr4ClassLoader; |
4 | 4 | use Elasticsearch\ClientBuilder; |
5 | -use Psr\Log\NullLogger; |
|
6 | -use GuzzleHttp\Ring\Client\CurlHandler; |
|
7 | 5 | |
8 | 6 | /** |
9 | 7 | * The Installer class installs phpMyFAQ. Classy. |
@@ -210,7 +210,7 @@ |
||
210 | 210 | { |
211 | 211 | global $languageCodes; |
212 | 212 | |
213 | - $search = array('language_' , '.php'); |
|
213 | + $search = array('language_', '.php'); |
|
214 | 214 | $languages = $languageFiles = []; |
215 | 215 | |
216 | 216 | $dir = new DirectoryIterator(PMF_LANGUAGE_DIR); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function __construct($translation) |
69 | 69 | { |
70 | 70 | $this->PMF_TRANSL = $translation; |
71 | - $this->nPlurals = (int) $this->PMF_TRANSL['nplurals']; |
|
71 | + $this->nPlurals = (int)$this->PMF_TRANSL['nplurals']; |
|
72 | 72 | $this->lang = $this->PMF_TRANSL['metaLanguage']; |
73 | 73 | |
74 | 74 | if ($this->plural($this->lang, 0) != -1) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // Note: expressions in .po files are not strict C expressions, so extra braces might be |
157 | 157 | // needed for that expression to work here (for example see 'lt') |
158 | 158 | case 'ar': |
159 | - return ($n == 0) ? 0 : ($n == 1 ? 1 : ($n == 2 ? 2 : (($n % 100 >= 3 && $n % 100 <= 10) ? 3 : (($n % 100 >= 11 && $n % 100 <= 99) || ($n % 100 == 1) || ($n % 100 == 2) ? 4 : 5)))); |
|
159 | + return ($n == 0) ? 0 : ($n == 1 ? 1 : ($n == 2 ? 2 : (($n%100 >= 3 && $n%100 <= 10) ? 3 : (($n%100 >= 11 && $n%100 <= 99) || ($n%100 == 1) || ($n%100 == 2) ? 4 : 5)))); |
|
160 | 160 | case 'bn': |
161 | 161 | return 0; |
162 | 162 | case 'cy': |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | case 'ko': |
197 | 197 | return 0; |
198 | 198 | case 'lt': |
199 | - return ($n % 10 == 1 && $n % 100 != 11) ? 0 : ($n % 10 >= 2 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); |
|
199 | + return ($n%10 == 1 && $n%100 != 11) ? 0 : ($n%10 >= 2 && ($n%100 < 10 || $n%100 >= 20) ? 1 : 2); |
|
200 | 200 | case 'lv': |
201 | - return ($n % 10 == 1 && $n % 100 != 11) ? 0 : ($n != 0 ? 1 : 2); |
|
201 | + return ($n%10 == 1 && $n%100 != 11) ? 0 : ($n != 0 ? 1 : 2); |
|
202 | 202 | case 'nb': |
203 | 203 | return $n != 1; |
204 | 204 | case 'nl': |
205 | 205 | return $n != 1; |
206 | 206 | case 'pl': |
207 | - return ($n == 1) ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); |
|
207 | + return ($n == 1) ? 0 : ($n%10 >= 2 && $n%10 <= 4 && ($n%100 < 10 || $n%100 >= 20) ? 1 : 2); |
|
208 | 208 | case 'pt': |
209 | 209 | return $n != 1; |
210 | 210 | case 'pt-br': |
211 | 211 | return $n > 1; |
212 | 212 | case 'ro': |
213 | - return ($n == 1) ? 0 : (($n == 0 || ($n % 100 > 0 && $n % 100 < 20)) ? 1 : 2); |
|
213 | + return ($n == 1) ? 0 : (($n == 0 || ($n%100 > 0 && $n%100 < 20)) ? 1 : 2); |
|
214 | 214 | case 'ru': |
215 | - return ($n % 10 == 1 && $n % 100 != 11) ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); |
|
215 | + return ($n%10 == 1 && $n%100 != 11) ? 0 : ($n%10 >= 2 && $n%10 <= 4 && ($n%100 < 10 || $n%100 >= 20) ? 1 : 2); |
|
216 | 216 | case 'sl': |
217 | - return ($n % 100 == 1) ? 0 : ($n % 100 == 2 ? 1 : ($n % 100 == 3 || n % 100 == 4 ? 2 : 3)); |
|
217 | + return ($n%100 == 1) ? 0 : ($n%100 == 2 ? 1 : ($n%100 == 3 || n%100 == 4 ? 2 : 3)); |
|
218 | 218 | case 'sr': |
219 | - return ($n % 10 == 1 && $n % 100 != 11) ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); |
|
219 | + return ($n%10 == 1 && $n%100 != 11) ? 0 : ($n%10 >= 2 && $n%10 <= 4 && ($n%100 < 10 || $n%100 >= 20) ? 1 : 2); |
|
220 | 220 | case 'sv': |
221 | 221 | return $n != 1; |
222 | 222 | case 'th': |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | case 'tw': |
227 | 227 | return 0; |
228 | 228 | case 'uk': |
229 | - return ($n % 10 == 1 && $n % 100 != 11) ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); |
|
229 | + return ($n%10 == 1 && $n%100 != 11) ? 0 : ($n%10 >= 2 && $n%10 <= 4 && ($n%100 < 10 || $n%100 >= 20) ? 1 : 2); |
|
230 | 230 | case 'vi': |
231 | 231 | return 0; |
232 | 232 | case 'zh': |
@@ -774,7 +774,7 @@ |
||
774 | 774 | $inforeasons[] = sprintf( |
775 | 775 | $PMF_LANG['ad_linkcheck_openurl_infoprefix'], |
776 | 776 | PMF_String::htmlspecialchars($value['absurl']) |
777 | - ).$value['reason']; |
|
777 | + ).$value['reason']; |
|
778 | 778 | } |
779 | 779 | } else { |
780 | 780 | $_classname = 'urlfail'; |
@@ -270,7 +270,7 @@ |
||
270 | 270 | while (list(, $type) = each($types)) { |
271 | 271 | preg_match_all("|[^?&]$type\=(\"?'?`?)([[:alnum:]\:\#%?=;&@/\ \.\_\-\{\}]+)\\1|i", $string, $matches); |
272 | 272 | $sz = sizeof($matches[2]); |
273 | - for ($i = 0;$i < $sz; ++$i) { |
|
273 | + for ($i = 0; $i < $sz; ++$i) { |
|
274 | 274 | $this->urlpool[$type][] = $matches[2][$i]; |
275 | 275 | ++$urlCount; |
276 | 276 | } |