@@ -139,7 +139,7 @@ |
||
139 | 139 | public function error() |
140 | 140 | { |
141 | 141 | if (!is_array($this->errors)) { |
142 | - $this->errors = array((string) $this->errors); |
|
142 | + $this->errors = array((string)$this->errors); |
|
143 | 143 | } |
144 | 144 | $message = ''; |
145 | 145 | foreach ($this->errors as $error) { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /* |
184 | 184 | * reduction factor for small font |
185 | 185 | */ |
186 | -define('K_SMALL_RATIO', 2 / 3); |
|
186 | +define('K_SMALL_RATIO', 2/3); |
|
187 | 187 | |
188 | 188 | require K_PATH_MAIN.'/tcpdf.php'; |
189 | 189 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | // Set font |
309 | 309 | if (array_key_exists($PMF_LANG['metaLanguage'], $this->fontFiles)) { |
310 | - $this->currentFont = (string) $this->fontFiles[$PMF_LANG['metaLanguage']]; |
|
310 | + $this->currentFont = (string)$this->fontFiles[$PMF_LANG['metaLanguage']]; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 |
@@ -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); |