@@ -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 | } |
@@ -94,10 +94,10 @@ |
||
| 94 | 94 | $result = $this->_config->getDb()->query($query); |
| 95 | 95 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
| 96 | 96 | $data[$row->id] = array( |
| 97 | - 'time' => $row->time, |
|
| 98 | - 'usr' => $row->usr, |
|
| 99 | - 'text' => $row->text, |
|
| 100 | - 'ip' => $row->ip, |
|
| 97 | + 'time' => $row->time, |
|
| 98 | + 'usr' => $row->usr, |
|
| 99 | + 'text' => $row->text, |
|
| 100 | + 'ip' => $row->ip, |
|
| 101 | 101 | ); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | WHERE |
| 149 | 149 | time < %d', |
| 150 | 150 | PMF_Db::getTablePrefix(), |
| 151 | - $_SERVER['REQUEST_TIME'] - 30 * 86400 |
|
| 151 | + $_SERVER['REQUEST_TIME'] - 30*86400 |
|
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | if ($this->_config->getDb()->query($query)) { |
@@ -153,8 +153,8 @@ |
||
| 153 | 153 | $bytes_addr = unpack('n*', inet_pton($addr)); |
| 154 | 154 | $bytes_test = unpack('n*', inet_pton($ip)); |
| 155 | 155 | |
| 156 | - for ($i = 1; $i <= ceil($preflen / 16); ++$i) { |
|
| 157 | - $left = $preflen - 16 * ($i - 1); |
|
| 156 | + for ($i = 1; $i <= ceil($preflen/16); ++$i) { |
|
| 157 | + $left = $preflen - 16*($i - 1); |
|
| 158 | 158 | if ($left > 16) { |
| 159 | 159 | $left = 16; |
| 160 | 160 | } |
@@ -150,9 +150,9 @@ |
||
| 150 | 150 | |
| 151 | 151 | foreach ($news as $item) { |
| 152 | 152 | $url = sprintf('%s?action=news&newsid=%d&newslang=%s', |
| 153 | - PMF_Link::getSystemRelativeUri(), |
|
| 154 | - $item['id'], |
|
| 155 | - $item['lang']); |
|
| 153 | + PMF_Link::getSystemRelativeUri(), |
|
| 154 | + $item['id'], |
|
| 155 | + $item['lang']); |
|
| 156 | 156 | $oLink = new PMF_Link($url, $this->_config); |
| 157 | 157 | |
| 158 | 158 | if (isset($item['header'])) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if ($this->_config->get('records.numberOfShownNewsEntries') > 0 && $this->_config->getDb()->numRows($result) > 0) { |
| 107 | 107 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
| 108 | 108 | ++$counter; |
| 109 | - if (($showArchive && ($counter > $this->_config->get('records.numberOfShownNewsEntries'))) || |
|
| 109 | + if (($showArchive && ($counter > $this->_config->get('records.numberOfShownNewsEntries'))) || |
|
| 110 | 110 | ((!$showArchive) && (!$forceConfLimit) && |
| 111 | 111 | ($counter <= $this->_config->get('records.numberOfShownNewsEntries'))) || |
| 112 | 112 | ((!$showArchive) && $forceConfLimit)) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'allowComments' => ('y' == $row->comment), |
| 126 | 126 | 'link' => $row->link, |
| 127 | 127 | 'linkTitle' => $row->linktitel, |
| 128 | - 'target' => $row->target, ); |
|
| 128 | + 'target' => $row->target,); |
|
| 129 | 129 | $news[] = $item; |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | 'allowComments' => $allowComments, |
| 287 | 287 | 'link' => $row->link, |
| 288 | 288 | 'linkTitle' => $row->linktitel, |
| 289 | - 'target' => $row->target, ); |
|
| 289 | + 'target' => $row->target,); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |