Passed
Branch code-cleanup (1a2937)
by Markus
08:01
created
lib/PageTagDetail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 class PageTagDetail extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $tag = Tag::getTagById ($this->idGet);
14
-        $this->idPage = $tag->getEntryId ();
13
+        $tag = Tag::getTagById($this->idGet);
14
+        $this->idPage = $tag->getEntryId();
15 15
         $this->title = $tag->name;
16
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksByTag ($this->idGet, $this->n);
16
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksByTag($this->idGet, $this->n);
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
lib/LinkNavigation.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
 class LinkNavigation extends Link
10 10
 {
11 11
     public function __construct($phref, $prel = NULL, $ptitle = NULL) {
12
-        parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle);
13
-        if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
14
-        if (!preg_match ("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href;
15
-        if (preg_match ("/(bookdetail|getJSON).php/", parent::getScriptName())) {
12
+        parent::__construct($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle);
13
+        if (!is_null(GetUrlParam(DB))) $this->href = addURLParameter($this->href, DB, GetUrlParam(DB));
14
+        if (!preg_match("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href;
15
+        if (preg_match("/(bookdetail|getJSON).php/", parent::getScriptName())) {
16 16
             $this->href = "index.php" . $this->href;
17 17
         } else {
18 18
             $this->href = parent::getScriptName() . $this->href;
Please login to merge, or discard this patch.
lib/Rating.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     const ALL_RATING_ID = "cops:rating";
11 11
 
12 12
     const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count";
13
-    const SQL_ALL_RATINGS ="select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating";
13
+    const SQL_ALL_RATINGS = "select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating";
14 14
     public $id;
15 15
     public $name;
16 16
 
@@ -19,41 +19,41 @@  discard block
 block discarded – undo
19 19
         $this->name = $pname;
20 20
     }
21 21
 
22
-    public function getUri () {
23
-        return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id";
22
+    public function getUri() {
23
+        return "?page=" . parent::PAGE_RATING_DETAIL . "&id=$this->id";
24 24
     }
25 25
 
26
-    public function getEntryId () {
27
-        return self::ALL_RATING_ID.":".$this->id;
26
+    public function getEntryId() {
27
+        return self::ALL_RATING_ID . ":" . $this->id;
28 28
     }
29 29
 
30 30
     public static function getCount() {
31 31
         // str_format (localize("ratings", count(array))
32
-        return parent::getCountGeneric ("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings");
32
+        return parent::getCountGeneric("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings");
33 33
     }
34 34
 
35 35
     public static function getAllRatings() {
36
-        return self::getEntryArray (self::SQL_ALL_RATINGS, array ());
36
+        return self::getEntryArray(self::SQL_ALL_RATINGS, array());
37 37
     }
38 38
 
39
-    public static function getEntryArray ($query, $params) {
40
-        list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1);
39
+    public static function getEntryArray($query, $params) {
40
+        list (, $result) = parent::executeQuery($query, self::RATING_COLUMNS, "", $params, -1);
41 41
         $entryArray = array();
42
-        while ($post = $result->fetchObject ())
42
+        while ($post = $result->fetchObject())
43 43
         {
44
-            $ratingObj = new Rating ($post->id, $post->rating);
45
-            $rating=$post->rating/2;
46
-            $rating = str_format (localize("ratingword", $rating), $rating);
47
-            array_push ($entryArray, new Entry ($rating, $ratingObj->getEntryId (),
48
-                str_format (localize("bookword", $post->count), $post->count), "text",
49
-                array ( new LinkNavigation ($ratingObj->getUri ())), "", $post->count));
44
+            $ratingObj = new Rating($post->id, $post->rating);
45
+            $rating = $post->rating / 2;
46
+            $rating = str_format(localize("ratingword", $rating), $rating);
47
+            array_push($entryArray, new Entry($rating, $ratingObj->getEntryId(),
48
+                str_format(localize("bookword", $post->count), $post->count), "text",
49
+                array(new LinkNavigation($ratingObj->getUri())), "", $post->count));
50 50
         }
51 51
         return $entryArray;
52 52
     }
53 53
 
54
-    public static function getRatingById ($ratingId) {
55
-        $result = parent::getDb ()->prepare('select rating from ratings where id = ?');
56
-        $result->execute (array ($ratingId));
57
-        return new Rating ($ratingId, $result->fetchColumn ());
54
+    public static function getRatingById($ratingId) {
55
+        $result = parent::getDb()->prepare('select rating from ratings where id = ?');
56
+        $result->execute(array($ratingId));
57
+        return new Rating($ratingId, $result->fetchColumn());
58 58
     }
59 59
 }
Please login to merge, or discard this patch.
lib/Entry.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
         Publisher::ALL_PUBLISHERS_ID => 'images/publisher.png'
32 32
     );
33 33
 
34
-    public function getUpdatedTime () {
35
-        if (!is_null ($this->localUpdated)) {
36
-            return date (DATE_ATOM, $this->localUpdated);
34
+    public function getUpdatedTime() {
35
+        if (!is_null($this->localUpdated)) {
36
+            return date(DATE_ATOM, $this->localUpdated);
37 37
         }
38
-        if (is_null (self::$updated)) {
38
+        if (is_null(self::$updated)) {
39 39
             self::$updated = time();
40 40
         }
41
-        return date (DATE_ATOM, self::$updated);
41
+        return date(DATE_ATOM, self::$updated);
42 42
     }
43 43
 
44
-    public function getNavLink () {
44
+    public function getNavLink() {
45 45
         foreach ($this->linkArray as $link) {
46 46
             if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; }
47 47
 
48
-            return $link->hrefXhtml ();
48
+            return $link->hrefXhtml();
49 49
         }
50 50
         return "#";
51 51
     }
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
         {
65 65
             foreach (self::$icons as $reg => $image)
66 66
             {
67
-                if (preg_match ("/" . $reg . "/", $pid)) {
68
-                    array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE));
67
+                if (preg_match("/" . $reg . "/", $pid)) {
68
+                    array_push($this->linkArray, new Link(getUrlWithVersion($image), "image/png", Link::OPDS_THUMBNAIL_TYPE));
69 69
                     break;
70 70
                 }
71 71
             }
72 72
         }
73 73
 
74
-        if (!is_null (GetUrlParam (DB))) $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id);
74
+        if (!is_null(GetUrlParam(DB))) $this->id = str_replace("cops:", "cops:" . GetUrlParam(DB) . ":", $this->id);
75 75
     }
76 76
 }
Please login to merge, or discard this patch.
lib/Link.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $this->activeFacet = $pactiveFacet;
31 31
     }
32 32
 
33
-    public function hrefXhtml () {
33
+    public function hrefXhtml() {
34 34
         return $this->href;
35 35
     }
36 36
 
Please login to merge, or discard this patch.
lib/PageAllAuthors.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 
9 9
 class PageAllAuthors extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13 13
         $this->title = localize("authors.title");
14
-        if (getCurrentOption ("author_split_first_letter") == 1) {
14
+        if (getCurrentOption("author_split_first_letter") == 1) {
15 15
             $this->entryArray = Author::getAllAuthorsByFirstLetter();
16 16
         }
17 17
         else {
Please login to merge, or discard this patch.
lib/PageRecentBooks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 
9 9
 class PageRecentBooks extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $this->title = localize ("recent.title");
14
-        $this->entryArray = Book::getAllRecentBooks ();
13
+        $this->title = localize("recent.title");
14
+        $this->entryArray = Book::getAllRecentBooks();
15 15
         $this->idPage = Book::ALL_RECENT_BOOKS_ID;
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
lib/PageAuthorDetail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 class PageAuthorDetail extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $author = Author::getAuthorById ($this->idGet);
14
-        $this->idPage = $author->getEntryId ();
13
+        $author = Author::getAuthorById($this->idGet);
14
+        $this->idPage = $author->getEntryId();
15 15
         $this->title = $author->name;
16
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksByAuthor ($this->idGet, $this->n);
16
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksByAuthor($this->idGet, $this->n);
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
lib/JSON_renderer.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -10,135 +10,135 @@  discard block
 block discarded – undo
10 10
 
11 11
 class JSONRenderer
12 12
 {
13
-    public static function getBookContentArray ($book) {
13
+    public static function getBookContentArray($book) {
14 14
         global $config;
15 15
         $i = 0;
16
-        $preferedData = array ();
16
+        $preferedData = array();
17 17
         foreach ($config['cops_prefered_format'] as $format)
18 18
         {
19 19
             if ($i == 2) { break; }
20
-            if ($data = $book->getDataFormat ($format)) {
20
+            if ($data = $book->getDataFormat($format)) {
21 21
                 $i++;
22
-                array_push ($preferedData, array ("url" => $data->getHtmlLink (), "name" => $format));
22
+                array_push($preferedData, array("url" => $data->getHtmlLink(), "name" => $format));
23 23
             }
24 24
         }
25 25
 
26 26
         $publisher = $book->getPublisher();
27
-        if (is_null ($publisher)) {
27
+        if (is_null($publisher)) {
28 28
             $pn = "";
29 29
             $pu = "";
30 30
         } else {
31 31
             $pn = $publisher->name;
32
-            $link = new LinkNavigation ($publisher->getUri ());
33
-            $pu = $link->hrefXhtml ();
32
+            $link = new LinkNavigation($publisher->getUri());
33
+            $pu = $link->hrefXhtml();
34 34
         }
35 35
 
36
-        $serie = $book->getSerie ();
37
-        if (is_null ($serie)) {
36
+        $serie = $book->getSerie();
37
+        if (is_null($serie)) {
38 38
             $sn = "";
39 39
             $scn = "";
40 40
             $su = "";
41 41
         } else {
42 42
             $sn = $serie->name;
43
-            $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name);
44
-            $link = new LinkNavigation ($serie->getUri ());
45
-            $su = $link->hrefXhtml ();
43
+            $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name);
44
+            $link = new LinkNavigation($serie->getUri());
45
+            $su = $link->hrefXhtml();
46 46
         }
47 47
 
48
-        return array ("id" => $book->id,
48
+        return array("id" => $book->id,
49 49
                       "hasCover" => $book->hasCover,
50 50
                       "preferedData" => $preferedData,
51
-                      "rating" => $book->getRating (),
51
+                      "rating" => $book->getRating(),
52 52
                       "publisherName" => $pn,
53 53
                       "publisherurl" => $pu,
54
-                      "pubDate" => $book->getPubDate (),
55
-                      "languagesName" => $book->getLanguages (),
56
-                      "authorsName" => $book->getAuthorsName (),
57
-                      "tagsName" => $book->getTagsName (),
54
+                      "pubDate" => $book->getPubDate(),
55
+                      "languagesName" => $book->getLanguages(),
56
+                      "authorsName" => $book->getAuthorsName(),
57
+                      "tagsName" => $book->getTagsName(),
58 58
                       "seriesName" => $sn,
59 59
                       "seriesIndex" => $book->seriesIndex,
60 60
                       "seriesCompleteName" => $scn,
61 61
                       "seriesurl" => $su);
62 62
     }
63 63
 
64
-    public static function getFullBookContentArray ($book) {
64
+    public static function getFullBookContentArray($book) {
65 65
         global $config;
66
-        $out = self::getBookContentArray ($book);
67
-        $database = GetUrlParam (DB);
68
-
69
-        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
70
-        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
71
-        $out ["content"] = $book->getComment (false);
72
-        $out ["datas"] = array ();
73
-        $dataKindle = $book->GetMostInterestingDataToSendToKindle ();
66
+        $out = self::getBookContentArray($book);
67
+        $database = GetUrlParam(DB);
68
+
69
+        $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml();
70
+        $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml();
71
+        $out ["content"] = $book->getComment(false);
72
+        $out ["datas"] = array();
73
+        $dataKindle = $book->GetMostInterestingDataToSendToKindle();
74 74
         foreach ($book->getDatas() as $data) {
75
-            $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0, "readerUrl" => "");
76
-            if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) {
75
+            $tab = array("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink(), "mail" => 0, "readerUrl" => "");
76
+            if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) {
77 77
                 $tab ["mail"] = 1;
78 78
             }
79 79
             if ($data->format == "EPUB") {
80 80
                 $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}";
81 81
             }
82
-            array_push ($out ["datas"], $tab);
82
+            array_push($out ["datas"], $tab);
83 83
         }
84
-        $out ["authors"] = array ();
85
-        foreach ($book->getAuthors () as $author) {
86
-            $link = new LinkNavigation ($author->getUri ());
87
-            array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ()));
84
+        $out ["authors"] = array();
85
+        foreach ($book->getAuthors() as $author) {
86
+            $link = new LinkNavigation($author->getUri());
87
+            array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml()));
88 88
         }
89
-        $out ["tags"] = array ();
90
-        foreach ($book->getTags () as $tag) {
91
-            $link = new LinkNavigation ($tag->getUri ());
92
-            array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ()));
89
+        $out ["tags"] = array();
90
+        foreach ($book->getTags() as $tag) {
91
+            $link = new LinkNavigation($tag->getUri());
92
+            array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml()));
93 93
         }
94 94
         ;
95 95
         return $out;
96 96
     }
97 97
 
98
-    public static function getContentArray ($entry) {
98
+    public static function getContentArray($entry) {
99 99
         if ($entry instanceof EntryBook) {
100
-            $out = array ( "title" => $entry->title);
101
-            $out ["book"] = self::getBookContentArray ($entry->book);
100
+            $out = array("title" => $entry->title);
101
+            $out ["book"] = self::getBookContentArray($entry->book);
102 102
             return $out;
103 103
         }
104
-        return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement );
104
+        return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement);
105 105
     }
106 106
 
107
-    public static function getContentArrayTypeahead ($page) {
108
-        $out = array ();
107
+    public static function getContentArrayTypeahead($page) {
108
+        $out = array();
109 109
         foreach ($page->entryArray as $entry) {
110 110
             if ($entry instanceof EntryBook) {
111
-                array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ()));
111
+                array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl()));
112 112
             } else {
113
-                if (empty ($entry->className) xor Base::noDatabaseSelected ()) {
114
-                    array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ()));
113
+                if (empty ($entry->className) xor Base::noDatabaseSelected()) {
114
+                    array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink()));
115 115
                 } else {
116
-                    array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ()));
116
+                    array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink()));
117 117
                 }
118 118
             }
119 119
         }
120 120
         return $out;
121 121
     }
122 122
 
123
-    public static function addCompleteArray ($in) {
123
+    public static function addCompleteArray($in) {
124 124
         global $config;
125 125
         $out = $in;
126 126
 
127
-        $out ["c"] = array ("version" => VERSION, "i18n" => array (
127
+        $out ["c"] = array("version" => VERSION, "i18n" => array(
128 128
                            "coverAlt" => localize("i18n.coversection"),
129 129
                            "authorsTitle" => localize("authors.title"),
130 130
                            "bookwordTitle" => localize("bookword.title"),
131 131
                            "tagsTitle" => localize("tags.title"),
132 132
                            "seriesTitle" => localize("series.title"),
133
-                           "customizeTitle" => localize ("customize.title"),
134
-                           "aboutTitle" => localize ("about.title"),
135
-                           "previousAlt" => localize ("paging.previous.alternate"),
136
-                           "nextAlt" => localize ("paging.next.alternate"),
137
-                           "searchAlt" => localize ("search.alternate"),
138
-                           "sortAlt" => localize ("sort.alternate"),
139
-                           "homeAlt" => localize ("home.alternate"),
140
-                           "cogAlt" => localize ("cog.alternate"),
141
-                           "permalinkAlt" => localize ("permalink.alternate"),
133
+                           "customizeTitle" => localize("customize.title"),
134
+                           "aboutTitle" => localize("about.title"),
135
+                           "previousAlt" => localize("paging.previous.alternate"),
136
+                           "nextAlt" => localize("paging.next.alternate"),
137
+                           "searchAlt" => localize("search.alternate"),
138
+                           "sortAlt" => localize("sort.alternate"),
139
+                           "homeAlt" => localize("home.alternate"),
140
+                           "cogAlt" => localize("cog.alternate"),
141
+                           "permalinkAlt" => localize("permalink.alternate"),
142 142
                            "publisherName" => localize("publisher.name"),
143 143
                            "pubdateTitle" => localize("pubdate.title"),
144 144
                            "languagesTitle" => localize("language.title"),
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
                            "sortorderAsc" => localize("search.sortorder.asc"),
147 147
                            "sortorderDesc" => localize("search.sortorder.desc"),
148 148
                            "customizeEmail" => localize("customize.email")),
149
-                       "url" => array (
149
+                       "url" => array(
150 150
                            "detailUrl" => "index.php?page=13&id={0}&db={1}",
151 151
                            "coverUrl" => "fetch.php?id={0}&db={1}",
152 152
                            "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
153
-                       "config" => array (
153
+                       "config" => array(
154 154
                            "use_fancyapps" => $config ["cops_use_fancyapps"],
155 155
                            "max_item_per_page" => $config['cops_max_item_per_page'],
156 156
                            "kindleHack"        => "",
157
-                           "server_side_rendering" => useServerSideRendering (),
157
+                           "server_side_rendering" => useServerSideRendering(),
158 158
                            "html_tag_filter" => $config['cops_html_tag_filter']));
159 159
         if ($config['cops_thumbnail_handling'] == "1") {
160 160
             $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
@@ -167,32 +167,32 @@  discard block
 block discarded – undo
167 167
         return $out;
168 168
     }
169 169
 
170
-    public static function getJson ($complete = false) {
170
+    public static function getJson($complete = false) {
171 171
         global $config;
172
-        $page = getURLParam ("page", Base::PAGE_INDEX);
173
-        $query = getURLParam ("query");
174
-        $search = getURLParam ("search");
175
-        $qid = getURLParam ("id");
176
-        $n = getURLParam ("n", "1");
177
-        $database = GetUrlParam (DB);
172
+        $page = getURLParam("page", Base::PAGE_INDEX);
173
+        $query = getURLParam("query");
174
+        $search = getURLParam("search");
175
+        $qid = getURLParam("id");
176
+        $n = getURLParam("n", "1");
177
+        $database = GetUrlParam(DB);
178 178
 
179
-        $currentPage = Page::getPage ($page, $qid, $query, $n);
180
-        $currentPage->InitializeContent ();
179
+        $currentPage = Page::getPage($page, $qid, $query, $n);
180
+        $currentPage->InitializeContent();
181 181
 
182 182
         if ($search) {
183
-            return self::getContentArrayTypeahead ($currentPage);
183
+            return self::getContentArrayTypeahead($currentPage);
184 184
         }
185 185
 
186
-        $out = array ( "title" => $currentPage->title);
187
-        $entries = array ();
186
+        $out = array("title" => $currentPage->title);
187
+        $entries = array();
188 188
         foreach ($currentPage->entryArray as $entry) {
189
-            array_push ($entries, self::getContentArray ($entry));
189
+            array_push($entries, self::getContentArray($entry));
190 190
         }
191
-        if (!is_null ($currentPage->book)) {
192
-            $out ["book"] = self::getFullBookContentArray ($currentPage->book);
191
+        if (!is_null($currentPage->book)) {
192
+            $out ["book"] = self::getFullBookContentArray($currentPage->book);
193 193
         }
194
-        $out ["databaseId"] = GetUrlParam (DB, "");
195
-        $out ["databaseName"] = Base::getDbName ();
194
+        $out ["databaseId"] = GetUrlParam(DB, "");
195
+        $out ["databaseName"] = Base::getDbName();
196 196
         if ($out ["databaseId"] == "") {
197 197
             $out ["databaseName"] = "";
198 198
         }
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
             $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"];
202 202
         }
203 203
         $out ["page"] = $page;
204
-        $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0;
204
+        $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0;
205 205
         $out ["entries"] = $entries;
206 206
         $out ["isPaginated"] = 0;
207
-        if ($currentPage->isPaginated ()) {
208
-            $prevLink = $currentPage->getPrevLink ();
209
-            $nextLink = $currentPage->getNextLink ();
207
+        if ($currentPage->isPaginated()) {
208
+            $prevLink = $currentPage->getPrevLink();
209
+            $nextLink = $currentPage->getNextLink();
210 210
             $out ["isPaginated"] = 1;
211 211
             $out ["prevLink"] = "";
212
-            if (!is_null ($prevLink)) {
213
-                $out ["prevLink"] = $prevLink->hrefXhtml ();
212
+            if (!is_null($prevLink)) {
213
+                $out ["prevLink"] = $prevLink->hrefXhtml();
214 214
             }
215 215
             $out ["nextLink"] = "";
216
-            if (!is_null ($nextLink)) {
217
-                $out ["nextLink"] = $nextLink->hrefXhtml ();
216
+            if (!is_null($nextLink)) {
217
+                $out ["nextLink"] = $nextLink->hrefXhtml();
218 218
             }
219
-            $out ["maxPage"] = $currentPage->getMaxPage ();
219
+            $out ["maxPage"] = $currentPage->getMaxPage();
220 220
             $out ["currentPage"] = $currentPage->n;
221 221
         }
222
-        if (!is_null (getURLParam ("complete")) || $complete) {
223
-            $out = self::addCompleteArray ($out);
222
+        if (!is_null(getURLParam("complete")) || $complete) {
223
+            $out = self::addCompleteArray($out);
224 224
        }
225 225
 
226 226
         $out ["containsBook"] = 0;
227
-        if ($currentPage->containsBook ()) {
227
+        if ($currentPage->containsBook()) {
228 228
             $out ["containsBook"] = 1;
229 229
         }
230 230
 
231
-        $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database);
231
+        $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database);
232 232
 
233 233
         if ($page == Base::PAGE_ABOUT) {
234
-            $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
234
+            $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
235 235
             $out ["fullhtml"] = $temp;
236 236
         }
237 237
 
238 238
         $out ["homeurl"] = "index.php";
239
-        if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
239
+        if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database);
240 240
 
241 241
         return $out;
242 242
     }
Please login to merge, or discard this patch.