@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // 2.5 versions only |
161 | 161 | if (version_compare($version, '2.6.0-alpha', '<') && !is_writeable('../template')) { |
162 | 162 | echo '<p class="alert alert-danger text-center"><strong>Please change the directory ../template '. |
163 | - 'and its contents writable (777 on Linux/UNIX).</strong></p>'; |
|
163 | + 'and its contents writable (777 on Linux/UNIX).</strong></p>'; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // We only support updates from 2.6+ |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | if (file_exists(PMF_ROOT_DIR.'/config/database.php')) { |
207 | 207 | if (!copy(PMF_ROOT_DIR.'/config/database.php', PMF_ROOT_DIR.'/config/database.bak.php')) { |
208 | 208 | echo '<p class="alert alert-danger"><strong>Error:</strong> The backup file ../config/database.bak.php '. |
209 | - 'could not be written. Please correct this!</p>'; |
|
209 | + 'could not be written. Please correct this!</p>'; |
|
210 | 210 | } else { |
211 | 211 | $checkDatabaseSetupFile = true; |
212 | 212 | } |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | if (!$result) { |
575 | 575 | echo '</div>'; |
576 | 576 | echo '<p class="alert alert-danger"><strong>Error:</strong> Please update your version of phpMyFAQ '. |
577 | - 'once again or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.'. |
|
578 | - '</p>'; |
|
577 | + 'once again or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.'. |
|
578 | + '</p>'; |
|
579 | 579 | printf( |
580 | 580 | '<p class="alert alert-danger"><strong>DB error:</strong> %s</p>', |
581 | 581 | $faqConfig->getDb()->error() |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | printf('<span title="%s"><i class="fa fa-circle"></i></span>', $executeQuery); |
852 | 852 | if (!$result) { |
853 | 853 | echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again '. |
854 | - 'or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.</p>'; |
|
854 | + 'or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.</p>'; |
|
855 | 855 | printf('<p class="error"><strong>DB error:</strong> %s</p>', $faqConfig->getDb()->error()); |
856 | 856 | printf('<code>%s</code>', htmlentities($executeQuery)); |
857 | 857 | PMF_System::renderFooter(); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | // Backup of config/elasticsearch.php if exists |
232 | 232 | if (file_exists(PMF_ROOT_DIR.'/config/elasticsearch.php')) { |
233 | 233 | if (!copy(PMF_ROOT_DIR.'/config/elasticsearch.php', PMF_ROOT_DIR.'/config/elasticsearch.bak.php')) { |
234 | - echo '<p class="alert alert-danger"><strong>Error:</strong> The backup file ' . |
|
234 | + echo '<p class="alert alert-danger"><strong>Error:</strong> The backup file '. |
|
235 | 235 | '../config/elasticsearch.bak.php could not be written. Please correct this!</p>'; |
236 | 236 | } else { |
237 | 237 | $checkElasticsearchSetupFile = true; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | foreach ($query as $key => $executeQuery) { |
600 | 600 | $result = $faqConfig->getDb()->query($executeQuery); |
601 | 601 | echo '.'; |
602 | - if (!($key % 100)) { |
|
602 | + if (!($key%100)) { |
|
603 | 603 | echo '<br />'; |
604 | 604 | } |
605 | 605 | if (!$result) { |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | } |
620 | 620 | usleep(10000); |
621 | 621 | ++$count; |
622 | - if (!($count % 10)) { |
|
622 | + if (!($count%10)) { |
|
623 | 623 | ob_flush(); |
624 | 624 | } |
625 | 625 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $faqConfig->add('main.enableGzipCompression', 'true'); |
714 | 714 | |
715 | 715 | if ('sqlite3' === $DB['type']) { |
716 | - $query[] = 'ALTER TABLE ' . $prefix . 'faquser ADD COLUMN success INT(1) NULL DEFAULT 1'; |
|
716 | + $query[] = 'ALTER TABLE '.$prefix.'faquser ADD COLUMN success INT(1) NULL DEFAULT 1'; |
|
717 | 717 | } elseif ('pgsql' === $DB['type']) { |
718 | 718 | $query[] = 'ALTER TABLE '.$prefix.'faquser ADD success SMALLINT NULL DEFAULT 1'; |
719 | 719 | } else { |
@@ -395,12 +395,12 @@ |
||
395 | 395 | public function update(Array $newConfigs) |
396 | 396 | { |
397 | 397 | $runtimeConfigs = [ |
398 | - 'core.database', // PMF_DB_Driver |
|
399 | - 'core.instance', // PMF_Instance |
|
400 | - 'core.language', // Language |
|
401 | - 'core.ldap', // PMF_Ldap |
|
402 | - 'core.ldapConfig', // $PMF_LDAP |
|
403 | - 'core.elasticsearch', // Elasticsearch\Client |
|
398 | + 'core.database', // PMF_DB_Driver |
|
399 | + 'core.instance', // PMF_Instance |
|
400 | + 'core.language', // Language |
|
401 | + 'core.ldap', // PMF_Ldap |
|
402 | + 'core.ldapConfig', // $PMF_LDAP |
|
403 | + 'core.elasticsearch', // Elasticsearch\Client |
|
404 | 404 | 'core.elasticsearchConfig' // $PMF_ES |
405 | 405 | ]; |
406 | 406 |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function createIndex() |
93 | 93 | { |
94 | 94 | $this->client->indices()->create($this->getParams()); |
95 | - return $this->putMapping();; |
|
95 | + return $this->putMapping(); ; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | 'categories' => $faq['category_id'] |
178 | 178 | ]; |
179 | 179 | |
180 | - if ($i % 1000 == 0) { |
|
180 | + if ($i%1000 == 0) { |
|
181 | 181 | $responses = $this->client->bulk($params); |
182 | 182 | $params = ['body' => []]; |
183 | 183 | unset($responses); |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | * SQL constants definitions |
29 | 29 | */ |
30 | 30 | define('FAQ_SQL_ACTIVE_YES', 'yes'); |
31 | -define('FAQ_SQL_ACTIVE_NO', 'no'); |
|
31 | +define('FAQ_SQL_ACTIVE_NO', 'no'); |
|
32 | 32 | |
33 | 33 | /* |
34 | 34 | * Query type definitions |
35 | 35 | */ |
36 | -define('FAQ_QUERY_TYPE_DEFAULT', 'faq_default'); |
|
37 | -define('FAQ_QUERY_TYPE_APPROVAL', 'faq_approval'); |
|
38 | -define('FAQ_QUERY_TYPE_EXPORT_PDF', 'faq_export_pdf'); |
|
36 | +define('FAQ_QUERY_TYPE_DEFAULT', 'faq_default'); |
|
37 | +define('FAQ_QUERY_TYPE_APPROVAL', 'faq_approval'); |
|
38 | +define('FAQ_QUERY_TYPE_EXPORT_PDF', 'faq_export_pdf'); |
|
39 | 39 | define('FAQ_QUERY_TYPE_EXPORT_XHTML', 'faq_export_xhtml'); |
40 | -define('FAQ_QUERY_TYPE_EXPORT_XML', 'faq_export_xml'); |
|
41 | -define('FAQ_QUERY_TYPE_RSS_LATEST', 'faq_rss_latest'); |
|
40 | +define('FAQ_QUERY_TYPE_EXPORT_XML', 'faq_export_xml'); |
|
41 | +define('FAQ_QUERY_TYPE_RSS_LATEST', 'faq_rss_latest'); |
|
42 | 42 | |
43 | 43 | /* |
44 | 44 | * Sorting type definitions |
@@ -384,12 +384,12 @@ discard block |
||
384 | 384 | |
385 | 385 | $result = $this->_config->getDb()->query($query); |
386 | 386 | $num = $this->_config->getDb()->numRows($result); |
387 | - $pages = (int) ceil($num / $numPerPage); |
|
387 | + $pages = (int)ceil($num/$numPerPage); |
|
388 | 388 | |
389 | 389 | if ($page == 1) { |
390 | 390 | $first = 0; |
391 | 391 | } else { |
392 | - $first = $page * $numPerPage - $numPerPage; |
|
392 | + $first = $page*$numPerPage - $numPerPage; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | if ($num > 0) { |
@@ -570,12 +570,12 @@ discard block |
||
570 | 570 | $result = $this->_config->getDb()->query($query); |
571 | 571 | |
572 | 572 | $num = $this->_config->getDb()->numRows($result); |
573 | - $pages = ceil($num / $this->_config->get('records.numberOfRecordsPerPage')); |
|
573 | + $pages = ceil($num/$this->_config->get('records.numberOfRecordsPerPage')); |
|
574 | 574 | |
575 | 575 | if ($page == 1) { |
576 | 576 | $first = 0; |
577 | 577 | } else { |
578 | - $first = ($page * $this->_config->get('records.numberOfRecordsPerPage')) - $this->_config->get('records.numberOfRecordsPerPage'); |
|
578 | + $first = ($page*$this->_config->get('records.numberOfRecordsPerPage')) - $this->_config->get('records.numberOfRecordsPerPage'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | if ($num > 0) { |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | AND |
1259 | 1259 | lang = '%s'", |
1260 | 1260 | PMF_Db::getTablePrefix(), |
1261 | - (int) $faqId, |
|
1261 | + (int)$faqId, |
|
1262 | 1262 | $this->_config->getDb()->escape($faqLang) |
1263 | 1263 | ); |
1264 | 1264 | |
@@ -2311,7 +2311,7 @@ discard block |
||
2311 | 2311 | 'category_id' => $row->category_id, |
2312 | 2312 | 'question' => $row->question, |
2313 | 2313 | 'created' => $row->created, |
2314 | - 'is_visible' => $row->is_visible, ); |
|
2314 | + 'is_visible' => $row->is_visible,); |
|
2315 | 2315 | } |
2316 | 2316 | } |
2317 | 2317 | |
@@ -2479,7 +2479,7 @@ discard block |
||
2479 | 2479 | 'revision_id' => $row->revision_id, |
2480 | 2480 | 'user' => $row->usr, |
2481 | 2481 | 'date' => $row->datum, |
2482 | - 'changelog' => $row->what, ); |
|
2482 | + 'changelog' => $row->what,); |
|
2483 | 2483 | } |
2484 | 2484 | } |
2485 | 2485 | |
@@ -2790,13 +2790,13 @@ discard block |
||
2790 | 2790 | $mode, |
2791 | 2791 | PMF_Db::getTablePrefix(), |
2792 | 2792 | $mode, |
2793 | - (int) $recordId); |
|
2793 | + (int)$recordId); |
|
2794 | 2794 | |
2795 | 2795 | $result = $this->_config->getDb()->query($query); |
2796 | 2796 | |
2797 | 2797 | if ($this->_config->getDb()->numRows($result) > 0) { |
2798 | 2798 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
2799 | - $permissions[] = (int) $row->permission; |
|
2799 | + $permissions[] = (int)$row->permission; |
|
2800 | 2800 | } |
2801 | 2801 | } |
2802 | 2802 | |
@@ -3043,7 +3043,7 @@ discard block |
||
3043 | 3043 | $lang |
3044 | 3044 | ); |
3045 | 3045 | |
3046 | - $retval = (bool) $this->_config->getDb()->query($update); |
|
3046 | + $retval = (bool)$this->_config->getDb()->query($update); |
|
3047 | 3047 | } |
3048 | 3048 | |
3049 | 3049 | return $retval; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | * @param int $record_id Record id |
1070 | 1070 | * @param string $language Language |
1071 | 1071 | * |
1072 | - * @return int |
|
1072 | + * @return boolean |
|
1073 | 1073 | */ |
1074 | 1074 | public function addCategoryRelations(Array $categories, $record_id, $language) |
1075 | 1075 | { |
@@ -1534,7 +1534,7 @@ discard block |
||
1534 | 1534 | * @param int $record_id Record id |
1535 | 1535 | * @param string $record_lang Record language |
1536 | 1536 | * |
1537 | - * @return array |
|
1537 | + * @return boolean |
|
1538 | 1538 | */ |
1539 | 1539 | public function addNewRevision($record_id, $record_lang) |
1540 | 1540 | { |
@@ -2534,7 +2534,7 @@ discard block |
||
2534 | 2534 | * Build a logic sequence, for a WHERE statement, of those category IDs |
2535 | 2535 | * children of the provided category ID, if any. |
2536 | 2536 | * |
2537 | - * @param $nCatid |
|
2537 | + * @param integer $nCatid |
|
2538 | 2538 | * @param $logicOp |
2539 | 2539 | * @param $oCat |
2540 | 2540 | * |
@@ -2564,14 +2564,14 @@ discard block |
||
2564 | 2564 | /** |
2565 | 2565 | * Build the SQL query for retrieving faq records according to the constraints provided. |
2566 | 2566 | * |
2567 | - * @param $QueryType |
|
2568 | - * @param $nCatid |
|
2569 | - * @param $bDownwards |
|
2570 | - * @param $lang |
|
2571 | - * @param $date |
|
2567 | + * @param string $QueryType |
|
2568 | + * @param integer $nCatid |
|
2569 | + * @param boolean $bDownwards |
|
2570 | + * @param string $lang |
|
2571 | + * @param string $date |
|
2572 | 2572 | * @param $faqid |
2573 | 2573 | * |
2574 | - * @return array |
|
2574 | + * @return string |
|
2575 | 2575 | * |
2576 | 2576 | * @since 2005-11-02 |
2577 | 2577 | * |
@@ -1868,16 +1868,16 @@ discard block |
||
1868 | 1868 | return true; |
1869 | 1869 | } |
1870 | 1870 | |
1871 | - /** |
|
1872 | - * Returns the visibility of a question. |
|
1873 | - * |
|
1874 | - * @param int $questionId |
|
1875 | - * |
|
1876 | - * @return string |
|
1877 | - */ |
|
1878 | - public function getVisibilityOfQuestion($questionId) |
|
1879 | - { |
|
1880 | - $query = sprintf(" |
|
1871 | + /** |
|
1872 | + * Returns the visibility of a question. |
|
1873 | + * |
|
1874 | + * @param int $questionId |
|
1875 | + * |
|
1876 | + * @return string |
|
1877 | + */ |
|
1878 | + public function getVisibilityOfQuestion($questionId) |
|
1879 | + { |
|
1880 | + $query = sprintf(" |
|
1881 | 1881 | SELECT |
1882 | 1882 | is_visible |
1883 | 1883 | FROM |
@@ -1891,15 +1891,15 @@ discard block |
||
1891 | 1891 | $this->_config->getLanguage()->getLanguage() |
1892 | 1892 | ); |
1893 | 1893 | |
1894 | - $result = $this->_config->getDb()->query($query); |
|
1895 | - if ($this->_config->getDb()->numRows($result) > 0) { |
|
1896 | - $row = $this->_config->getDb()->fetchObject($result); |
|
1894 | + $result = $this->_config->getDb()->query($query); |
|
1895 | + if ($this->_config->getDb()->numRows($result) > 0) { |
|
1896 | + $row = $this->_config->getDb()->fetchObject($result); |
|
1897 | 1897 | |
1898 | - return $row->is_visible; |
|
1899 | - } |
|
1898 | + return $row->is_visible; |
|
1899 | + } |
|
1900 | 1900 | |
1901 | - return; |
|
1902 | - } |
|
1901 | + return; |
|
1902 | + } |
|
1903 | 1903 | |
1904 | 1904 | /** |
1905 | 1905 | * Sets the visibility of a question. |
@@ -2455,7 +2455,7 @@ discard block |
||
2455 | 2455 | 'answer_id' => $row->answer_id, |
2456 | 2456 | 'is_visible' => $row->is_visible, |
2457 | 2457 | ); |
2458 | - } |
|
2458 | + } |
|
2459 | 2459 | } |
2460 | 2460 | |
2461 | 2461 | return $questions; |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | |
322 | 322 | if ($cat['lang'] == $lang) { |
323 | 323 | // add sub category (if current language) |
324 | - printf(' |
|
324 | + printf(' |
|
325 | 325 | <a class="btn btn-info btn-sm" href="?action=addcategory&cat=%s&lang=%s"><span title="%s" class="fa fa-plus fa-fw"></span></a> ', |
326 | - $cat['id'], |
|
327 | - $cat['lang'], |
|
328 | - $PMF_LANG['ad_quick_category'] |
|
329 | - ); |
|
326 | + $cat['id'], |
|
327 | + $cat['lang'], |
|
328 | + $PMF_LANG['ad_quick_category'] |
|
329 | + ); |
|
330 | 330 | |
331 | - // rename (sub) category (if current language) |
|
332 | - printf(' |
|
331 | + // rename (sub) category (if current language) |
|
332 | + printf(' |
|
333 | 333 | <a class="btn btn-info btn-sm" href="?action=editcategory&cat=%s"><span title="%s" class="fa fa-edit fa-fw"></a> ', |
334 | - $cat['id'], |
|
335 | - $PMF_LANG['ad_kateg_rename'] |
|
336 | - ); |
|
334 | + $cat['id'], |
|
335 | + $PMF_LANG['ad_kateg_rename'] |
|
336 | + ); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // translate category (always) |
@@ -357,20 +357,20 @@ discard block |
||
357 | 357 | |
358 | 358 | if ($cat['lang'] == $lang) { |
359 | 359 | // cut category (if current language) |
360 | - printf( |
|
361 | - '<a class="btn btn-warning btn-sm" href="?action=cutcategory&cat=%s"><span title="%s" class="fa fa-cut fa-fw"></a> ', |
|
362 | - $cat['id'], |
|
363 | - $PMF_LANG['ad_categ_cut'] |
|
364 | - ); |
|
360 | + printf( |
|
361 | + '<a class="btn btn-warning btn-sm" href="?action=cutcategory&cat=%s"><span title="%s" class="fa fa-cut fa-fw"></a> ', |
|
362 | + $cat['id'], |
|
363 | + $PMF_LANG['ad_categ_cut'] |
|
364 | + ); |
|
365 | 365 | |
366 | 366 | if ($category->numParent($cat['parent_id']) > 1) { |
367 | 367 | // move category (if current language) AND more than 1 category at the same level) |
368 | - printf( |
|
369 | - '<a class="btn btn-warning btn-sm" href="?action=movecategory&cat=%s&parent_id=%s"><span title="%s" class="fa fa-sort fa-fw"></a> ', |
|
370 | - $cat['id'], |
|
371 | - $cat['parent_id'], |
|
372 | - $PMF_LANG['ad_categ_move'] |
|
373 | - ); |
|
368 | + printf( |
|
369 | + '<a class="btn btn-warning btn-sm" href="?action=movecategory&cat=%s&parent_id=%s"><span title="%s" class="fa fa-sort fa-fw"></a> ', |
|
370 | + $cat['id'], |
|
371 | + $cat['parent_id'], |
|
372 | + $PMF_LANG['ad_categ_move'] |
|
373 | + ); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | <i aria-hidden="true" class="fa fa-plus fa-fw"></i> <?php echo $PMF_LANG['ad_kateg_add']; ?> |
37 | 37 | </a> |
38 | 38 | <a class="btn btn-info" href="?action=showcategory"> |
39 | - <i aria-hidden="true" class="fa fa-th fa-fw"></i> <?php echo $PMF_LANG['ad_categ_show'];?> |
|
39 | + <i aria-hidden="true" class="fa fa-th fa-fw"></i> <?php echo $PMF_LANG['ad_categ_show']; ?> |
|
40 | 40 | </a> |
41 | 41 | </div> |
42 | 42 | </h2> |
@@ -490,8 +490,8 @@ |
||
490 | 490 | $this->headers['X-Mailer'] = $this->_mailer; |
491 | 491 | |
492 | 492 | // X-MSMail-Priority |
493 | - if (isset($this->priorities[(int) $this->priority])) { |
|
494 | - $this->headers['X-MSMail-Priority'] = $this->priorities[(int) $this->priority]; |
|
493 | + if (isset($this->priorities[(int)$this->priority])) { |
|
494 | + $this->headers['X-MSMail-Priority'] = $this->priorities[(int)$this->priority]; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | // X-Originating-IP |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | echo PMF_Language::languageOptions( |
109 | 109 | str_replace( |
110 | 110 | array( |
111 | - 'language_', |
|
112 | - '.php', |
|
111 | + 'language_', |
|
112 | + '.php', |
|
113 | 113 | ), |
114 | 114 | '', |
115 | 115 | $faqConfig->get('main.language') |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } else { |
121 | 121 | echo '<option value="language_en.php">English</option>'; |
122 | 122 | } |
123 | - break; |
|
123 | + break; |
|
124 | 124 | |
125 | 125 | case 'records.orderby': |
126 | 126 | echo PMF_Configuration::sortingOptions($faqConfig->get($key)); |
@@ -134,7 +134,7 @@ |
||
134 | 134 | </tr> |
135 | 135 | <tr> |
136 | 136 | <td><?php echo $PMF_LANG['ad_stat_vpd'] ?>:</td> |
137 | - <td><?php echo ($danz != 0) ? round(($vanz / $danz), 2) : 0 ?></td> |
|
137 | + <td><?php echo ($danz != 0) ? round(($vanz/$danz), 2) : 0 ?></td> |
|
138 | 138 | </tr> |
139 | 139 | <tr> |
140 | 140 | <td><?php echo $PMF_LANG['ad_stat_fien'] ?>:</td> |
@@ -623,12 +623,15 @@ discard block |
||
623 | 623 | <input type="radio" name="active" value="no" |
624 | 624 | <?php if (isset($sul)) { echo $sul; } ?>> |
625 | 625 | <?php echo $PMF_LANG['ad_gen_no'] ?> |
626 | - <?php else: ?> |
|
626 | + <?php else { |
|
627 | + : ?> |
|
627 | 628 | <br> |
628 | 629 | <input type="radio" name="active" value="no" checked> |
629 | 630 | <?php echo $PMF_LANG['ad_gen_no'] ?> |
630 | 631 | |
631 | - <?php endif; ?> |
|
632 | + <?php endif; |
|
633 | +} |
|
634 | +?> |
|
632 | 635 | </label> |
633 | 636 | </div> |
634 | 637 | </div> |
@@ -689,9 +692,12 @@ discard block |
||
689 | 692 | </div> |
690 | 693 | </div> |
691 | 694 | </div> |
692 | - <?php else: ?> |
|
695 | + <?php else { |
|
696 | + : ?> |
|
693 | 697 | <input type="hidden" name="grouppermission" value="all"> |
694 | - <?php endif; ?> |
|
698 | + <?php endif; |
|
699 | +} |
|
700 | +?> |
|
695 | 701 | <div class="panel-heading"> |
696 | 702 | <?php echo $PMF_LANG['ad_entry_userpermission']; ?> |
697 | 703 | </div> |