mbirth /
cops
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * COPS (Calibre OPDS PHP Server) class file |
||
| 4 | * |
||
| 5 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
||
| 6 | * @author Sébastien Lucas <[email protected]> |
||
| 7 | */ |
||
| 8 | |||
| 9 | class PageQueryResult extends Page |
||
| 10 | { |
||
| 11 | const SCOPE_TAG = "tag"; |
||
|
0 ignored issues
–
show
|
|||
| 12 | const SCOPE_RATING = "rating"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
rating does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 13 | const SCOPE_SERIES = "series"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
series does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 14 | const SCOPE_AUTHOR = "author"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
author does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 15 | const SCOPE_BOOK = "book"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
book does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 16 | const SCOPE_PUBLISHER = "publisher"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
publisher does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 17 | |||
| 18 | 24 | private function useTypeahead () { |
|
| 19 | 24 | return !is_null (getURLParam ("search")); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
search does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 20 | } |
||
| 21 | |||
| 22 | 29 | private function searchByScope ($scope, $limit = FALSE) { |
|
| 23 | 29 | $n = $this->n; |
|
| 24 | 29 | $numberPerPage = NULL; |
|
| 25 | 29 | $queryNormedAndUp = trim($this->query); |
|
| 26 | 29 | if (useNormAndUp ()) { |
|
| 27 | 7 | $queryNormedAndUp = normAndUp ($this->query); |
|
| 28 | 7 | } |
|
| 29 | 29 | if ($limit) { |
|
| 30 | 22 | $n = 1; |
|
| 31 | 22 | $numberPerPage = 5; |
|
| 32 | 22 | } |
|
| 33 | switch ($scope) { |
||
| 34 | 29 | case self::SCOPE_BOOK : |
|
| 35 | 23 | $array = Book::getBooksByStartingLetter ('%' . $queryNormedAndUp, $n, NULL, $numberPerPage); |
|
| 36 | 23 | break; |
|
| 37 | 28 | case self::SCOPE_AUTHOR : |
|
| 38 | 23 | $array = Author::getAuthorsForSearch ('%' . $queryNormedAndUp); |
|
| 39 | 23 | break; |
|
| 40 | 25 | case self::SCOPE_SERIES : |
|
| 41 | 22 | $array = Serie::getAllSeriesByQuery ($queryNormedAndUp); |
|
| 42 | 22 | break; |
|
| 43 | 24 | case self::SCOPE_TAG : |
|
| 44 | 23 | $array = Tag::getAllTagsByQuery ($queryNormedAndUp, $n, NULL, $numberPerPage); |
|
| 45 | 23 | break; |
|
| 46 | 23 | case self::SCOPE_PUBLISHER : |
|
| 47 | 23 | $array = Publisher::getAllPublishersByQuery ($queryNormedAndUp); |
|
| 48 | 23 | break; |
|
| 49 | default: |
||
| 50 | $array = Book::getBooksByQuery ( |
||
| 51 | array ("all" => "%" . $queryNormedAndUp . "%"), $n); |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
all does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
% does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 52 | } |
||
| 53 | |||
| 54 | 29 | return $array; |
|
| 55 | } |
||
| 56 | |||
| 57 | 22 | public function doSearchByCategory () { |
|
| 58 | 22 | $database = GetUrlParam (DB); |
|
| 59 | 22 | $out = array (); |
|
| 60 | 22 | $pagequery = Base::PAGE_OPENSEARCH_QUERY; |
|
| 61 | 22 | $dbArray = array (""); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 62 | 22 | $d = $database; |
|
| 63 | 22 | $query = $this->query; |
|
| 64 | // Special case when no databases were chosen, we search on all databases |
||
| 65 | 22 | if (Base::noDatabaseSelected ()) { |
|
| 66 | 1 | $dbArray = Base::getDbNameList (); |
|
| 67 | 1 | $d = 0; |
|
| 68 | 1 | } |
|
| 69 | 22 | foreach ($dbArray as $key) { |
|
| 70 | 22 | if (Base::noDatabaseSelected ()) { |
|
| 71 | 1 | array_push ($this->entryArray, new Entry ($key, DB . ":query:{$d}", |
|
| 72 | 1 | " ", "text", |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
text does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 73 | 1 | array ( new LinkNavigation ("?" . DB . "={$d}")), "tt-header")); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
? does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
tt-header does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 74 | 1 | Base::getDb ($d); |
|
| 75 | 1 | } |
|
| 76 | 22 | foreach (array (PageQueryResult::SCOPE_BOOK, |
|
| 77 | 22 | PageQueryResult::SCOPE_AUTHOR, |
|
| 78 | 22 | PageQueryResult::SCOPE_SERIES, |
|
| 79 | 22 | PageQueryResult::SCOPE_TAG, |
|
| 80 | 22 | PageQueryResult::SCOPE_PUBLISHER) as $key) { |
|
| 81 | 22 | if (in_array($key, getCurrentOption ('ignored_categories'))) { |
|
| 82 | 3 | continue; |
|
| 83 | } |
||
| 84 | 22 | $array = $this->searchByScope ($key, TRUE); |
|
| 85 | |||
| 86 | 22 | $i = 0; |
|
| 87 | 22 | if (count ($array) == 2 && is_array ($array [0])) { |
|
| 88 | 22 | $total = $array [1]; |
|
| 89 | 22 | $array = $array [0]; |
|
| 90 | 22 | } else { |
|
| 91 | 22 | $total = count($array); |
|
| 92 | } |
||
| 93 | 22 | if ($total > 0) { |
|
| 94 | // Comment to help the perl i18n script |
||
| 95 | // str_format (localize("bookword", count($array)) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 96 | // str_format (localize("authorword", count($array)) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 97 | // str_format (localize("seriesword", count($array)) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 98 | // str_format (localize("tagword", count($array)) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 99 | // str_format (localize("publisherword", count($array)) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 100 | 21 | array_push ($this->entryArray, new Entry (str_format (localize ("search.result.{$key}"), $this->query), DB . ":query:{$d}:{$key}", |
|
| 101 | 21 | str_format (localize("{$key}word", $total), $total), "text", |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
text does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 102 | 21 | array ( new LinkNavigation ("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")), |
|
| 103 | 21 | Base::noDatabaseSelected () ? "" : "tt-header", $total)); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
tt-header does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 104 | 21 | } |
|
| 105 | 22 | if (!Base::noDatabaseSelected () && $this->useTypeahead ()) { |
|
| 106 | 6 | foreach ($array as $entry) { |
|
| 107 | 6 | array_push ($this->entryArray, $entry); |
|
| 108 | 6 | $i++; |
|
| 109 | 6 | if ($i > 4) { break; }; |
|
| 110 | 6 | } |
|
| 111 | 6 | } |
|
| 112 | 22 | } |
|
| 113 | 22 | $d++; |
|
| 114 | 22 | if (Base::noDatabaseSelected ()) { |
|
| 115 | 1 | Base::clearDb (); |
|
| 116 | 1 | } |
|
| 117 | 22 | } |
|
| 118 | 22 | return $out; |
|
| 119 | } |
||
| 120 | |||
| 121 | 31 | public function InitializeContent () |
|
| 122 | { |
||
| 123 | 31 | $scope = getURLParam ("scope"); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
scope does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 124 | 31 | if (empty ($scope)) { |
|
| 125 | 24 | $this->title = str_format (localize ("search.result"), $this->query); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
search.result does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 126 | 24 | } else { |
|
| 127 | // Comment to help the perl i18n script |
||
| 128 | // str_format (localize ("search.result.author"), $this->query) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 129 | // str_format (localize ("search.result.tag"), $this->query) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 130 | // str_format (localize ("search.result.series"), $this->query) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 131 | // str_format (localize ("search.result.book"), $this->query) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 132 | // str_format (localize ("search.result.publisher"), $this->query) |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 133 | 7 | $this->title = str_format (localize ("search.result.{$scope}"), $this->query); |
|
| 134 | } |
||
| 135 | |||
| 136 | 31 | $crit = "%" . $this->query . "%"; |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
% does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 137 | |||
| 138 | // Special case when we are doing a search and no database is selected |
||
| 139 | 31 | if (Base::noDatabaseSelected () && !$this->useTypeahead ()) { |
|
| 140 | 2 | $i = 0; |
|
| 141 | 2 | foreach (Base::getDbNameList () as $key) { |
|
| 142 | 2 | Base::clearDb (); |
|
| 143 | 2 | list ($array, $totalNumber) = Book::getBooksByQuery (array ("all" => $crit), 1, $i, 1); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
all does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 144 | 2 | array_push ($this->entryArray, new Entry ($key, DB . ":query:{$i}", |
|
| 145 | 2 | str_format (localize ("bookword", $totalNumber), $totalNumber), "text", |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
bookword does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
text does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 146 | 2 | array ( new LinkNavigation ("?" . DB . "={$i}&page=9&query=" . $this->query)), "", $totalNumber)); |
|
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
? does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 147 | 2 | $i++; |
|
| 148 | 2 | } |
|
| 149 | 2 | return; |
|
| 150 | } |
||
| 151 | 29 | if (empty ($scope)) { |
|
| 152 | 22 | $this->doSearchByCategory (); |
|
| 153 | 22 | return; |
|
| 154 | } |
||
| 155 | |||
| 156 | 7 | $array = $this->searchByScope ($scope); |
|
| 157 | 7 | if (count ($array) == 2 && is_array ($array [0])) { |
|
| 158 | 2 | list ($this->entryArray, $this->totalNumber) = $array; |
|
| 159 | 2 | } else { |
|
| 160 | 5 | $this->entryArray = $array; |
|
| 161 | } |
||
| 162 | 7 | } |
|
| 163 | } |
||
| 164 |
PHP provides two ways to mark string literals. Either with single quotes
'literal'or with double quotes"literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (
\') and the backslash (\\). Every other character is displayed as is.Double quoted string literals may contain other variables or more complex escape sequences.
will print an indented:
Single is ValueIf your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.
For more information on PHP string literals and available escape sequences see the PHP core documentation.