@@ -133,18 +133,18 @@ |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | $search->setTable($fdTable) |
136 | - ->setResultColumns(array( |
|
136 | + ->setResultColumns(array( |
|
137 | 137 | $fdTable . '.id AS id', |
138 | 138 | $fdTable . '.lang AS lang', |
139 | 139 | $fdTable . '.solution_id AS solution_id', |
140 | 140 | $fcrTable . '.category_id AS category_id', |
141 | 141 | $fdTable . '.thema AS question', |
142 | 142 | $fdTable . '.content AS answer')) |
143 | - ->setJoinedTable($fcrTable) |
|
144 | - ->setJoinedColumns(array( |
|
143 | + ->setJoinedTable($fcrTable) |
|
144 | + ->setJoinedColumns(array( |
|
145 | 145 | $fdTable . '.id = ' . $fcrTable . '.record_id', |
146 | 146 | $fdTable . '.lang = ' . $fcrTable . '.record_lang')) |
147 | - ->setConditions($condition); |
|
147 | + ->setConditions($condition); |
|
148 | 148 | |
149 | 149 | if (is_numeric($searchTerm)) { |
150 | 150 | $search->setMatchingColumns(array($fdTable . '.solution_id')); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function __construct(PMF_Configuration $config) |
75 | 75 | { |
76 | 76 | $this->_config = $config; |
77 | - $this->_table = PMF_Db::getTablePrefix() . 'faqsearches'; |
|
77 | + $this->_table = PMF_Db::getTablePrefix().'faqsearches'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -108,48 +108,48 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function search($searchTerm, $allLanguages = true) |
110 | 110 | { |
111 | - $fdTable = PMF_Db::getTablePrefix() . 'faqdata'; |
|
112 | - $fcrTable = PMF_Db::getTablePrefix() . 'faqcategoryrelations'; |
|
113 | - $condition = array($fdTable . '.active' => "'yes'"); |
|
111 | + $fdTable = PMF_Db::getTablePrefix().'faqdata'; |
|
112 | + $fcrTable = PMF_Db::getTablePrefix().'faqcategoryrelations'; |
|
113 | + $condition = array($fdTable.'.active' => "'yes'"); |
|
114 | 114 | $search = PMF_Search_Factory::create($this->_config, array('database' => PMF_Db::getType())); |
115 | 115 | |
116 | 116 | if (!is_null($this->getCategoryId()) && 0 < $this->getCategoryId()) { |
117 | 117 | if ($this->getCategory() instanceof PMF_Category) { |
118 | 118 | $children = $this->getCategory()->getChildNodes($this->getCategoryId()); |
119 | 119 | $selectedCategory = array( |
120 | - $fcrTable . '.category_id' => array_merge((array)$this->getCategoryId(), $children) |
|
120 | + $fcrTable.'.category_id' => array_merge((array)$this->getCategoryId(), $children) |
|
121 | 121 | ); |
122 | 122 | } else { |
123 | 123 | $selectedCategory = array( |
124 | - $fcrTable . '.category_id' => $this->getCategoryId() |
|
124 | + $fcrTable.'.category_id' => $this->getCategoryId() |
|
125 | 125 | ); |
126 | 126 | } |
127 | 127 | $condition = array_merge($selectedCategory, $condition); |
128 | 128 | } |
129 | 129 | |
130 | 130 | if ((!$allLanguages) && (!is_numeric($searchTerm))) { |
131 | - $selectedLanguage = array($fdTable . '.lang' => "'" . $this->_config->getLanguage()->getLanguage() . "'"); |
|
131 | + $selectedLanguage = array($fdTable.'.lang' => "'".$this->_config->getLanguage()->getLanguage()."'"); |
|
132 | 132 | $condition = array_merge($selectedLanguage, $condition); |
133 | 133 | } |
134 | 134 | |
135 | 135 | $search->setTable($fdTable) |
136 | 136 | ->setResultColumns(array( |
137 | - $fdTable . '.id AS id', |
|
138 | - $fdTable . '.lang AS lang', |
|
139 | - $fdTable . '.solution_id AS solution_id', |
|
140 | - $fcrTable . '.category_id AS category_id', |
|
141 | - $fdTable . '.thema AS question', |
|
142 | - $fdTable . '.content AS answer')) |
|
137 | + $fdTable.'.id AS id', |
|
138 | + $fdTable.'.lang AS lang', |
|
139 | + $fdTable.'.solution_id AS solution_id', |
|
140 | + $fcrTable.'.category_id AS category_id', |
|
141 | + $fdTable.'.thema AS question', |
|
142 | + $fdTable.'.content AS answer')) |
|
143 | 143 | ->setJoinedTable($fcrTable) |
144 | 144 | ->setJoinedColumns(array( |
145 | - $fdTable . '.id = ' . $fcrTable . '.record_id', |
|
146 | - $fdTable . '.lang = ' . $fcrTable . '.record_lang')) |
|
145 | + $fdTable.'.id = '.$fcrTable.'.record_id', |
|
146 | + $fdTable.'.lang = '.$fcrTable.'.record_lang')) |
|
147 | 147 | ->setConditions($condition); |
148 | 148 | |
149 | 149 | if (is_numeric($searchTerm)) { |
150 | - $search->setMatchingColumns(array($fdTable . '.solution_id')); |
|
150 | + $search->setMatchingColumns(array($fdTable.'.solution_id')); |
|
151 | 151 | } else { |
152 | - $search->setMatchingColumns(array($fdTable . '.thema', $fdTable . '.content', $fdTable . '.keywords')); |
|
152 | + $search->setMatchingColumns(array($fdTable.'.thema', $fdTable.'.content', $fdTable.'.keywords')); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $result = $search->search($searchTerm); |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | self::$dbType = $type; |
78 | 78 | |
79 | 79 | if (0 === strpos($type, 'pdo_')) { |
80 | - $class = 'PMF_DB_Pdo_' . ucfirst(substr($type, 4)); |
|
80 | + $class = 'PMF_DB_Pdo_'.ucfirst(substr($type, 4)); |
|
81 | 81 | } else { |
82 | - $class = 'PMF_DB_' . ucfirst($type); |
|
82 | + $class = 'PMF_DB_'.ucfirst($type); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | if (class_exists($class)) { |
86 | 86 | self::$instance = new $class; |
87 | 87 | return self::$instance; |
88 | 88 | } else { |
89 | - throw new PMF_Exception('Invalid Database Type: ' . $type); |
|
89 | + throw new PMF_Exception('Invalid Database Type: '.$type); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function checkOnEmptyTable($tableName) |
134 | 134 | { |
135 | - if (self::$instance->numRows(self::$instance->query('SELECT * FROM ' . PMF_Db::getTablePrefix() . $tableName)) < 1) { |
|
135 | + if (self::$instance->numRows(self::$instance->query('SELECT * FROM '.PMF_Db::getTablePrefix().$tableName)) < 1) { |
|
136 | 136 | return true; |
137 | 137 | } else { |
138 | 138 | return false; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | <body> |
161 | 161 | <div class="container"> |
162 | 162 | <p class="alert alert-danger">The connection to the database server could not be established.</p> |
163 | - <p class="alert alert-danger">The error message of the database server:<br />' . $method . '</p> |
|
163 | + <p class="alert alert-danger">The error message of the database server:<br />' . $method.'</p> |
|
164 | 164 | </div> |
165 | 165 | </body> |
166 | 166 | </html>'; |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function addCommonHeaders() |
22 | 22 | { |
23 | 23 | $this->response->headers->set('Expires', 'Thu, 07 Apr 1977 14:47:00 GMT'); |
24 | - $this->response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT'); |
|
24 | + $this->response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s').' GMT'); |
|
25 | 25 | $this->response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate'); |
26 | 26 | $this->response->headers->set('Cache-Control', 'post-check=0, pre-check=0', false); |
27 | 27 | $this->response->headers->set('Pragma', 'no-cache'); |
@@ -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 |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | public function fetchAll($statement) |
142 | 142 | { |
143 | 143 | if (false === $statement) { |
144 | - throw new Exception('Error while fetching result: ' . $this->error()); |
|
144 | + throw new Exception('Error while fetching result: '.$this->error()); |
|
145 | 145 | } |
146 | 146 | |
147 | - return $statement->fetchAll(PDO::FETCH_OBJ ); |
|
147 | + return $statement->fetchAll(PDO::FETCH_OBJ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $error = $this->conn->errorInfo(); |
218 | 218 | |
219 | - return $error[0] . ': ' . $error[2]; |
|
219 | + return $error[0].': '.$error[2]; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -244,7 +244,7 @@ |
||
244 | 244 | * |
245 | 245 | * @param string $prefix Table prefix |
246 | 246 | * |
247 | - * @return array |
|
247 | + * @return string[] |
|
248 | 248 | */ |
249 | 249 | function getTableNames($prefix = '') |
250 | 250 | { |