@@ -96,7 +96,7 @@ |
||
| 96 | 96 | |
| 97 | 97 | return sprintf( |
| 98 | 98 | '<a class="btn tag" href="?action=search&tagging_id=%s">%s (%d)</a> ', |
| 99 | - implode(',', $this->getTaggingIds()) . ',' . $tagId, |
|
| 99 | + implode(',', $this->getTaggingIds()).','.$tagId, |
|
| 100 | 100 | $tagName, |
| 101 | 101 | $relevance |
| 102 | 102 | ); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | if (isset($PMF_LANG[$caption])) { |
| 102 | 102 | $caption = $PMF_LANG[$caption]; |
| 103 | 103 | } else { |
| 104 | - $caption = 'No string for ' . $caption; |
|
| 104 | + $caption = 'No string for '.$caption; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $this->entries[] = array( |
| 108 | 108 | 'caption' => $caption, |
| 109 | 109 | 'isActive' => $active == $action, |
| 110 | - 'linkUrl' => ($action != '') ? '?action=' . $action : '' |
|
| 110 | + 'linkUrl' => ($action != '') ? '?action='.$action : '' |
|
| 111 | 111 | ); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | private function evaluatePermission($restrictions) |
| 147 | 147 | { |
| 148 | - if (false !== strpos ($restrictions, '+')) { |
|
| 148 | + if (false !== strpos($restrictions, '+')) { |
|
| 149 | 149 | $retval = false; |
| 150 | - foreach (explode('+',$restrictions) as $_restriction) { |
|
| 150 | + foreach (explode('+', $restrictions) as $_restriction) { |
|
| 151 | 151 | $retval = $retval || $this->evaluatePermission($_restriction); |
| 152 | 152 | if ($retval) { |
| 153 | 153 | break; |
@@ -187,8 +187,9 @@ |
||
| 187 | 187 | // check user rights, set them TRUE |
| 188 | 188 | $allUserRights = $user->perm->getAllUserRights($user->getUserId()); |
| 189 | 189 | foreach ($allRights as $right) { |
| 190 | - if (in_array($right['right_id'], $allUserRights)) |
|
| 191 | - $this->permission[$right['name']] = true; |
|
| 190 | + if (in_array($right['right_id'], $allUserRights)) { |
|
| 191 | + $this->permission[$right['name']] = true; |
|
| 192 | + } |
|
| 192 | 193 | } |
| 193 | 194 | } |
| 194 | 195 | |
@@ -64,11 +64,11 @@ |
||
| 64 | 64 | public function addHeader() |
| 65 | 65 | { |
| 66 | 66 | header('Expires: Thu, 07 Apr 1977 14:47:00 GMT'); |
| 67 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 67 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 68 | 68 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
| 69 | 69 | header('Cache-Control: post-check=0, pre-check=0', false); |
| 70 | 70 | header('Pragma: no-cache'); |
| 71 | 71 | header('Vary: Negotiate,Accept'); |
| 72 | - header('Content-type: ' . $this->contentType); |
|
| 72 | + header('Content-type: '.$this->contentType); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | \ No newline at end of file |
@@ -395,12 +395,12 @@ discard block |
||
| 395 | 395 | ); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if (! function_exists('date_default_timezone_set')) { |
|
| 398 | + if (!function_exists('date_default_timezone_set')) { |
|
| 399 | 399 | $errors[] = 'Sorry, but setting a default timezone doesn\'t work in your environment!'; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if (! $this->_system->checkDatabase()) { |
|
| 403 | - $dbError = "No supported database detected! Please install one of the following database systems and " . |
|
| 402 | + if (!$this->_system->checkDatabase()) { |
|
| 403 | + $dbError = "No supported database detected! Please install one of the following database systems and ". |
|
| 404 | 404 | "enable the corresponding PHP extension in php.ini:"; |
| 405 | 405 | $dbError .= "<ul>"; |
| 406 | 406 | foreach ($this->_system->getSupportedDatabases() as $database) { |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $errors[] = $dbError; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if (! $this->_system->checkRequiredExtensions()) { |
|
| 413 | + if (!$this->_system->checkRequiredExtensions()) { |
|
| 414 | 414 | $extError = "The following extensions are missing! Please enable the PHP extension(s) in php.ini."; |
| 415 | 415 | $extError .= "<ul>"; |
| 416 | 416 | foreach ($this->_system->getMissingExtensions() as $extension) { |
@@ -420,16 +420,16 @@ discard block |
||
| 420 | 420 | $errors[] = $extError; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - if (! $this->_system->checkRegisterGlobals()) { |
|
| 423 | + if (!$this->_system->checkRegisterGlobals()) { |
|
| 424 | 424 | $errors[] = "Please disable register_globals!"; |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - if (! $this->_system->checkMagicQuotesGpc()) { |
|
| 427 | + if (!$this->_system->checkMagicQuotesGpc()) { |
|
| 428 | 428 | $errors[] = "Please disable magic_quotes_gpc!"; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - if (! $this->_system->checkphpMyFAQInstallation()) { |
|
| 432 | - $errors[] = "It seems you're already running a version of phpMyFAQ. Please use the " . |
|
| 431 | + if (!$this->_system->checkphpMyFAQInstallation()) { |
|
| 432 | + $errors[] = "It seems you're already running a version of phpMyFAQ. Please use the ". |
|
| 433 | 433 | "<a href=\"update.php\">update script</a>."; |
| 434 | 434 | } |
| 435 | 435 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | */ |
| 444 | 444 | public function checkPreUpgrade() |
| 445 | 445 | { |
| 446 | - if (! $this->checkMinimumPhpVersion()) { |
|
| 446 | + if (!$this->checkMinimumPhpVersion()) { |
|
| 447 | 447 | printf( |
| 448 | 448 | '<p class="alert alert-danger">Sorry, but you need PHP %s or later!</p>', |
| 449 | 449 | PMF_System::VERSION_MINIMUM_PHP |
@@ -451,18 +451,18 @@ discard block |
||
| 451 | 451 | PMF_System::renderFooter(); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (! is_readable(PMF_ROOT_DIR . '/config/database.php')) { |
|
| 455 | - echo '<p class="alert alert-error">It seems you never run a version of phpMyFAQ.<br />' . |
|
| 454 | + if (!is_readable(PMF_ROOT_DIR.'/config/database.php')) { |
|
| 455 | + echo '<p class="alert alert-error">It seems you never run a version of phpMyFAQ.<br />'. |
|
| 456 | 456 | 'Please use the <a href="setup.php">install script</a>.</p>'; |
| 457 | 457 | PMF_System::renderFooter(); |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if (! $this->_system->checkRegisterGlobals()) { |
|
| 460 | + if (!$this->_system->checkRegisterGlobals()) { |
|
| 461 | 461 | echo '<p class="alert alert-danger">Please disable register_globals!</p>'; |
| 462 | 462 | PMF_System::renderFooter(); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - if (! $this->_system->checkMagicQuotesGpc()) { |
|
| 465 | + if (!$this->_system->checkMagicQuotesGpc()) { |
|
| 466 | 466 | echo '<p class="alert alert-danger">Please disable magic_quotes_gpc!</p>'; |
| 467 | 467 | PMF_System::renderFooter(); |
| 468 | 468 | } |
@@ -524,24 +524,24 @@ discard block |
||
| 524 | 524 | $errors = array(); |
| 525 | 525 | |
| 526 | 526 | if ((@ini_get('safe_mode') == 'On' || @ini_get('safe_mode') === 1)) { |
| 527 | - $errors[] = "The PHP safe mode is enabled. You may have problems when phpMyFAQ tries to write in some " . |
|
| 527 | + $errors[] = "The PHP safe mode is enabled. You may have problems when phpMyFAQ tries to write in some ". |
|
| 528 | 528 | "directories."; |
| 529 | 529 | } |
| 530 | - if (! extension_loaded('gd')) { |
|
| 531 | - $errors[] = "You don't have GD support enabled in your PHP installation. Please enable GD support in " . |
|
| 530 | + if (!extension_loaded('gd')) { |
|
| 531 | + $errors[] = "You don't have GD support enabled in your PHP installation. Please enable GD support in ". |
|
| 532 | 532 | "your php.ini file otherwise you can't use Captchas for spam protection."; |
| 533 | 533 | } |
| 534 | - if (! function_exists('imagettftext')) { |
|
| 535 | - $errors[] = "You don't have Freetype support enabled in the GD extension of your PHP installation. " . |
|
| 536 | - "Please enable Freetype support in GD extension otherwise the Captchas for spam protection " . |
|
| 534 | + if (!function_exists('imagettftext')) { |
|
| 535 | + $errors[] = "You don't have Freetype support enabled in the GD extension of your PHP installation. ". |
|
| 536 | + "Please enable Freetype support in GD extension otherwise the Captchas for spam protection ". |
|
| 537 | 537 | "will be quite easy to break."; |
| 538 | 538 | } |
| 539 | - if (! extension_loaded('curl') || ! extension_loaded('openssl')) { |
|
| 540 | - $errors[] = "You don't have cURL and/or OpenSSL support enabled in your PHP installation. Please enable " . |
|
| 539 | + if (!extension_loaded('curl') || !extension_loaded('openssl')) { |
|
| 540 | + $errors[] = "You don't have cURL and/or OpenSSL support enabled in your PHP installation. Please enable ". |
|
| 541 | 541 | "cURL and/or OpenSSL support in your php.ini file otherwise you can't use the Twitter support."; |
| 542 | 542 | } |
| 543 | - if (! extension_loaded('fileinfo')) { |
|
| 544 | - $errors[] = "You don't have Fileinfo support enabled in your PHP installation. Please enable Fileinfo " . |
|
| 543 | + if (!extension_loaded('fileinfo')) { |
|
| 544 | + $errors[] = "You don't have Fileinfo support enabled in your PHP installation. Please enable Fileinfo ". |
|
| 545 | 545 | "support in your php.ini file otherwise you can't use our backup/restore functionality."; |
| 546 | 546 | } |
| 547 | 547 | return $errors; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $dbSetup['dbType'] = PMF_Filter::filterInput(INPUT_POST, 'sql_type', FILTER_SANITIZE_STRING); |
| 578 | 578 | if (!is_null($dbSetup['dbType'])) { |
| 579 | 579 | $dbSetup['dbType'] = trim($dbSetup['dbType']); |
| 580 | - if (! file_exists(PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php')) { |
|
| 580 | + if (!file_exists(PMF_ROOT_DIR.'/setup/assets/sql/'.$dbSetup['dbType'].'.sql.php')) { |
|
| 581 | 581 | printf( |
| 582 | 582 | '<p class="alert alert-danger"><strong>Error:</strong> Invalid server type: %s</p>', |
| 583 | 583 | $dbSetup['dbType'] |
@@ -590,31 +590,31 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | $dbSetup['dbServer'] = PMF_Filter::filterInput(INPUT_POST, 'sql_server', FILTER_SANITIZE_STRING); |
| 593 | - if (is_null($dbSetup['dbServer']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 593 | + if (is_null($dbSetup['dbServer']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 594 | 594 | echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database server.</p>\n"; |
| 595 | 595 | PMF_System::renderFooter(true); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | $dbSetup['dbPort'] = PMF_Filter::filterInput(INPUT_POST, 'sql_port', FILTER_VALIDATE_INT); |
| 599 | - if (is_null($dbSetup['dbPort']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 599 | + if (is_null($dbSetup['dbPort']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 600 | 600 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> Please add a valid database port.</p>\n"; |
| 601 | 601 | PMF_System::renderFooter(true); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | $dbSetup['dbUser'] = PMF_Filter::filterInput(INPUT_POST, 'sql_user', FILTER_SANITIZE_STRING); |
| 605 | - if (is_null($dbSetup['dbUser']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 605 | + if (is_null($dbSetup['dbUser']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 606 | 606 | echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database username.</p>\n"; |
| 607 | 607 | PMF_System::renderFooter(true); |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | $dbSetup['dbPassword'] = PMF_Filter::filterInput(INPUT_POST, 'sql_passwort', FILTER_UNSAFE_RAW); |
| 611 | - if (is_null($dbSetup['dbPassword']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 611 | + if (is_null($dbSetup['dbPassword']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 612 | 612 | // Password can be empty... |
| 613 | 613 | $dbSetup['dbPassword'] = ''; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | $dbSetup['dbDatabaseName'] = PMF_Filter::filterInput(INPUT_POST, 'sql_db', FILTER_SANITIZE_STRING); |
| 617 | - if (is_null($dbSetup['dbDatabaseName']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 617 | + if (is_null($dbSetup['dbDatabaseName']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 618 | 618 | echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database name.</p>\n"; |
| 619 | 619 | PMF_System::renderFooter(true); |
| 620 | 620 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $ldapSetup['ldapPassword'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_password', FILTER_SANITIZE_STRING, ''); |
| 669 | 669 | |
| 670 | 670 | // check LDAP connection |
| 671 | - require PMF_ROOT_DIR . "/inc/PMF/Ldap.php"; |
|
| 671 | + require PMF_ROOT_DIR."/inc/PMF/Ldap.php"; |
|
| 672 | 672 | $ldap = new PMF_Ldap($configuration); |
| 673 | 673 | $ldap->connect( |
| 674 | 674 | $ldapSetup['ldapServer'], |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $ldapSetup['ldapPassword'] |
| 679 | 679 | ); |
| 680 | 680 | if (!$ldap) { |
| 681 | - echo "<p class=\"alert alert-danger\"><strong>LDAP Error:</strong> " . $ldap->error() . "</p>\n"; |
|
| 681 | + echo "<p class=\"alert alert-danger\"><strong>LDAP Error:</strong> ".$ldap->error()."</p>\n"; |
|
| 682 | 682 | PMF_System::renderFooter(true); |
| 683 | 683 | } |
| 684 | 684 | } |
@@ -704,12 +704,12 @@ discard block |
||
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | if (strlen($password) <= 5 || strlen($password_retyped) <= 5) { |
| 707 | - echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are too short.' . |
|
| 707 | + echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are too short.'. |
|
| 708 | 708 | ' Please set your password and your retyped password with a minimum of 6 characters.</p>'; |
| 709 | 709 | PMF_System::renderFooter(true); |
| 710 | 710 | } |
| 711 | 711 | if ($password != $password_retyped) { |
| 712 | - echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are not equal.' . |
|
| 712 | + echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are not equal.'. |
|
| 713 | 713 | ' Please check your password and your retyped password.</p>'; |
| 714 | 714 | PMF_System::renderFooter(true); |
| 715 | 715 | } |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | $instanceSetup->setRootDir(PMF_ROOT_DIR); |
| 724 | 724 | |
| 725 | 725 | // Write the DB variables in database.php |
| 726 | - if (! $instanceSetup->createDatabaseFile($dbSetup)) { |
|
| 726 | + if (!$instanceSetup->createDatabaseFile($dbSetup)) { |
|
| 727 | 727 | echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/database.php.</p>"; |
| 728 | 728 | $this->_system->cleanInstallation(); |
| 729 | 729 | PMF_System::renderFooter(true); |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | // check LDAP if available |
| 733 | 733 | if (extension_loaded('ldap') && !is_null($ldapEnabled)) { |
| 734 | - if (! $instanceSetup->createLdapFile($ldapSetup, '')) { |
|
| 734 | + if (!$instanceSetup->createLdapFile($ldapSetup, '')) { |
|
| 735 | 735 | echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/ldap.php.</p>"; |
| 736 | 736 | $this->_system->cleanInstallation(); |
| 737 | 737 | PMF_System::renderFooter(true); |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | // connect to the database using config/database.php |
| 742 | - require PMF_ROOT_DIR . '/config/database.php'; |
|
| 742 | + require PMF_ROOT_DIR.'/config/database.php'; |
|
| 743 | 743 | $db = PMF_Db::factory($dbSetup['dbType']); |
| 744 | 744 | $db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']); |
| 745 | 745 | if (!$db) { |
@@ -748,15 +748,15 @@ discard block |
||
| 748 | 748 | PMF_System::renderFooter(true); |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | - require PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php'; // CREATE TABLES |
|
| 752 | - require PMF_ROOT_DIR . '/setup/assets/sql/stopwords.sql.php'; // INSERTs for stopwords |
|
| 751 | + require PMF_ROOT_DIR.'/setup/assets/sql/'.$dbSetup['dbType'].'.sql.php'; // CREATE TABLES |
|
| 752 | + require PMF_ROOT_DIR.'/setup/assets/sql/stopwords.sql.php'; // INSERTs for stopwords |
|
| 753 | 753 | |
| 754 | 754 | $this->_system->setDatabase($db); |
| 755 | 755 | |
| 756 | 756 | echo '<p>'; |
| 757 | 757 | |
| 758 | 758 | // Erase any table before starting creating the required ones |
| 759 | - if (! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 759 | + if (!PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 760 | 760 | $this->_system->dropTables($uninst); |
| 761 | 761 | } |
| 762 | 762 | |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | } |
| 776 | 776 | usleep(2500); |
| 777 | 777 | $count++; |
| 778 | - if (!($count % 10)) { |
|
| 778 | + if (!($count%10)) { |
|
| 779 | 779 | echo '| '; |
| 780 | 780 | } |
| 781 | 781 | } |
@@ -797,9 +797,9 @@ discard block |
||
| 797 | 797 | |
| 798 | 798 | // add admin account and rights |
| 799 | 799 | $admin = new PMF_User($configuration); |
| 800 | - if (! $admin->createUser($loginname, $password, 1)) { |
|
| 800 | + if (!$admin->createUser($loginname, $password, 1)) { |
|
| 801 | 801 | printf( |
| 802 | - "<p class=\"alert alert-danger\"><strong>Fatal installation error:</strong><br>" . |
|
| 802 | + "<p class=\"alert alert-danger\"><strong>Fatal installation error:</strong><br>". |
|
| 803 | 803 | "Couldn't create the admin user: %s</p>\n", |
| 804 | 804 | $admin->error() |
| 805 | 805 | ); |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | $instanceData = array( |
| 826 | 826 | 'url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), |
| 827 | 827 | 'instance' => $link->getSystemRelativeUri('setup/index.php'), |
| 828 | - 'comment' => 'phpMyFAQ ' . PMF_System::getVersion() |
|
| 828 | + 'comment' => 'phpMyFAQ '.PMF_System::getVersion() |
|
| 829 | 829 | ); |
| 830 | 830 | $faqInstance = new PMF_Instance($configuration); |
| 831 | 831 | $faqInstance->addInstance($instanceData); |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | echo "<p class=\"alert alert-danger\">Please delete the file <em>./setup/index.php</em> manually.</p>\n"; |
| 851 | 851 | } |
| 852 | 852 | // Remove 'update.php' file |
| 853 | - if (@unlink(dirname($_SERVER['PATH_TRANSLATED']) . '/update.php')) { |
|
| 853 | + if (@unlink(dirname($_SERVER['PATH_TRANSLATED']).'/update.php')) { |
|
| 854 | 854 | echo "<p class=\"alert alert-success\">The file <em>./setup/update.php</em> was deleted automatically.</p>\n"; |
| 855 | 855 | } else { |
| 856 | 856 | echo "<p class=\"alert alert-danger\">Please delete the file <em>./setup/update.php</em> manually.</p>\n"; |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | public function renderLanguageOptions(Array $languageCodes) |
| 868 | 868 | { |
| 869 | 869 | $options = ''; |
| 870 | - if ($dir = @opendir(PMF_ROOT_DIR . '/lang')) { |
|
| 870 | + if ($dir = @opendir(PMF_ROOT_DIR.'/lang')) { |
|
| 871 | 871 | while ($dat = @readdir($dir)) { |
| 872 | 872 | if (substr($dat, -4) == '.php') { |
| 873 | 873 | $options .= sprintf('<option value="%s"', $dat); |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | return sprintf( |
| 139 | 139 | 'https://twitter.com/share?url=%s&text=%s', |
| 140 | 140 | urlencode($link->toString()), |
| 141 | - $this->getQuestion() . urlencode(' | ' . $url) |
|
| 141 | + $this->getQuestion().urlencode(' | '.$url) |
|
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -47,10 +47,10 @@ |
||
| 47 | 47 | public function connect($host, $user, $password, $database = '') |
| 48 | 48 | { |
| 49 | 49 | try { |
| 50 | - $this->conn = new PDO('mysql:host=' . $host . ';dbname=' . $database . ';charset=UTF8', $user, $password); |
|
| 50 | + $this->conn = new PDO('mysql:host='.$host.';dbname='.$database.';charset=UTF8', $user, $password); |
|
| 51 | 51 | $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 52 | 52 | } catch (PDOException $e) { |
| 53 | - PMF_Db::errorPage('Database connection failed: ' . $e->getMessage()); |
|
| 53 | + PMF_Db::errorPage('Database connection failed: '.$e->getMessage()); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | - public static function filterInput ($type, $variableName, $filter, $default = null) |
|
| 47 | + public static function filterInput($type, $variableName, $filter, $default = null) |
|
| 48 | 48 | { |
| 49 | 49 | $return = filter_input($type, $variableName, $filter); |
| 50 | 50 | return (is_null($return) || $return === false) ? $default : $return; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return mixed |
| 60 | 60 | */ |
| 61 | - public static function filterInputArray ($type, Array $definition) |
|
| 61 | + public static function filterInputArray($type, Array $definition) |
|
| 62 | 62 | { |
| 63 | 63 | return filter_input_array($type, $definition); |
| 64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return mixed |
| 74 | 74 | */ |
| 75 | - public static function filterVar ($variable, $filter, $default = null) |
|
| 75 | + public static function filterVar($variable, $filter, $default = null) |
|
| 76 | 76 | { |
| 77 | 77 | $return = filter_var($variable, $filter); |
| 78 | 78 | return ($return === false) ? $default : $return; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $urlData = []; |
| 89 | 89 | $cleanUrlData = []; |
| 90 | 90 | |
| 91 | - if (! isset($_SERVER['QUERY_STRING'])) { |
|
| 91 | + if (!isset($_SERVER['QUERY_STRING'])) { |
|
| 92 | 92 | return ''; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -175,8 +175,8 @@ |
||
| 175 | 175 | $result = $this->_config->getDb()->query($query); |
| 176 | 176 | |
| 177 | 177 | if ($result) { |
| 178 | - $res = $this->_config->getDb()->fetchObject($result); |
|
| 179 | - $timestamp = $res->time; |
|
| 178 | + $res = $this->_config->getDb()->fetchObject($result); |
|
| 179 | + $timestamp = $res->time; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | return $timestamp; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if (0 == $bots && false == $banned) { |
| 113 | 113 | if (!isset($sid)) { |
| 114 | - $sid = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix() . 'faqsessions', 'sid'); |
|
| 114 | + $sid = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix().'faqsessions', 'sid'); |
|
| 115 | 115 | // Sanity check: force the session cookie to contains the current $sid |
| 116 | 116 | if (!is_null($sidc) && (!$sidc != $sid)) { |
| 117 | 117 | self::setCookie(self::PMF_COOKIE_NAME_SESSIONID, $sid); |
@@ -132,20 +132,20 @@ discard block |
||
| 132 | 132 | $this->_config->getDb()->query($query); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $data = $sid.';' . |
|
| 136 | - str_replace(';', ',', $action) . ';' . |
|
| 137 | - $id . ';' . |
|
| 138 | - $remoteAddr . ';' . |
|
| 139 | - str_replace(';', ',', isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '') . ';' . |
|
| 140 | - str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . ';' . |
|
| 141 | - str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])) . ';' . |
|
| 142 | - $_SERVER['REQUEST_TIME'] . ";\n"; |
|
| 143 | - $file = './data/tracking' . date('dmY'); |
|
| 135 | + $data = $sid.';'. |
|
| 136 | + str_replace(';', ',', $action).';'. |
|
| 137 | + $id.';'. |
|
| 138 | + $remoteAddr.';'. |
|
| 139 | + str_replace(';', ',', isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '').';'. |
|
| 140 | + str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '').';'. |
|
| 141 | + str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])).';'. |
|
| 142 | + $_SERVER['REQUEST_TIME'].";\n"; |
|
| 143 | + $file = './data/tracking'.date('dmY'); |
|
| 144 | 144 | |
| 145 | 145 | if (is_writeable($file)) { |
| 146 | 146 | file_put_contents($file, $data, FILE_APPEND); |
| 147 | 147 | } else { |
| 148 | - throw new PMF_Exception('Cannot write to ' . $file); |
|
| 148 | + throw new PMF_Exception('Cannot write to '.$file); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | // Set the correct HTTP headers: |
| 209 | 209 | // 1. Prevent proxies&browsers caching |
| 210 | - $this->response->headers->set("Last-Modified", gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 210 | + $this->response->headers->set("Last-Modified", gmdate("D, d M Y H:i:s")." GMT"); |
|
| 211 | 211 | $this->response->headers->set("Expires", "0"); |
| 212 | 212 | $this->response->headers->set("Cache-Control", "private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); |
| 213 | 213 | $this->response->headers->set("Pragma", "no-cache"); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $this->response->headers->set("Content-Type", $mimeType); |
| 221 | 221 | } |
| 222 | 222 | // RFC2616, �19.5.1: $filename must be a quoted-string |
| 223 | - $this->response->headers->set("Content-Disposition", $this->disposition."; filename=\"" . PMF_Export::getExportTimestamp() . "_" . $filename."\""); |
|
| 223 | + $this->response->headers->set("Content-Disposition", $this->disposition."; filename=\"".PMF_Export::getExportTimestamp()."_".$filename."\""); |
|
| 224 | 224 | if (!empty($description)) { |
| 225 | 225 | $this->response->headers->set("Content-Description", $description); |
| 226 | 226 | } |