Completed
Push — master ( b8091b...3ad122 )
by Markus
04:08
created
lib/Language.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
         $this->lang_code = $plang_code;
19 19
     }
20 20
 
21
-    public function getUri () {
22
-        return "?page=".Base::PAGE_LANGUAGE_DETAIL."&id=$this->id";
21
+    public function getUri() {
22
+        return "?page=" . Base::PAGE_LANGUAGE_DETAIL . "&id=$this->id";
23 23
     }
24 24
 
25
-    public function getEntryId () {
26
-        return self::ALL_LANGUAGES_ID.":".$this->id;
25
+    public function getEntryId() {
26
+        return self::ALL_LANGUAGES_ID . ":" . $this->id;
27 27
     }
28 28
 
29
-    public static function getLanguageString ($code) {
30
-        $string = localize("languages.".$code);
31
-        if (preg_match ("/^languages/", $string)) {
29
+    public static function getLanguageString($code) {
30
+        $string = localize("languages." . $code);
31
+        if (preg_match("/^languages/", $string)) {
32 32
             return $code;
33 33
         }
34 34
         return $string;
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 
37 37
     public static function getCount() {
38 38
         // str_format (localize("languages.alphabetical", count(array))
39
-        return Base::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, Base::PAGE_ALL_LANGUAGES);
39
+        return Base::getCountGeneric("languages", self::ALL_LANGUAGES_ID, Base::PAGE_ALL_LANGUAGES);
40 40
     }
41 41
 
42
-    public static function getLanguageById ($languageId) {
43
-        $result = Base::getDb ()->prepare('select id, lang_code  from languages where id = ?');
44
-        $result->execute (array ($languageId));
45
-        if ($post = $result->fetchObject ()) {
46
-            return new Language ($post->id, Language::getLanguageString ($post->lang_code));
42
+    public static function getLanguageById($languageId) {
43
+        $result = Base::getDb()->prepare('select id, lang_code  from languages where id = ?');
44
+        $result->execute(array($languageId));
45
+        if ($post = $result->fetchObject()) {
46
+            return new Language($post->id, Language::getLanguageString($post->lang_code));
47 47
         }
48 48
         return NULL;
49 49
     }
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 group by languages.id, books_languages_link.lang_code
58 58
 order by languages.lang_code');
59 59
         $entryArray = array();
60
-        while ($post = $result->fetchObject ())
60
+        while ($post = $result->fetchObject())
61 61
         {
62
-            $language = new Language ($post->id, $post->lang_code);
63
-            array_push ($entryArray, new Entry (Language::getLanguageString ($language->lang_code), $language->getEntryId (),
64
-                str_format (localize("bookword", $post->count), $post->count), "text",
65
-                array ( new LinkNavigation ($language->getUri ())), "", $post->count));
62
+            $language = new Language($post->id, $post->lang_code);
63
+            array_push($entryArray, new Entry(Language::getLanguageString($language->lang_code), $language->getEntryId(),
64
+                str_format(localize("bookword", $post->count), $post->count), "text",
65
+                array(new LinkNavigation($language->getUri())), "", $post->count));
66 66
         }
67 67
         return $entryArray;
68 68
     }
Please login to merge, or discard this patch.
lib/Author.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,69 +25,69 @@
 block discarded – undo
25 25
         $this->sort = $post->sort;
26 26
     }
27 27
 
28
-    public function getUri () {
29
-        return "?page=".Base::PAGE_AUTHOR_DETAIL."&id=$this->id";
28
+    public function getUri() {
29
+        return "?page=" . Base::PAGE_AUTHOR_DETAIL . "&id=$this->id";
30 30
     }
31 31
 
32
-    public function getEntryId () {
33
-        return self::ALL_AUTHORS_ID.":".$this->id;
32
+    public function getEntryId() {
33
+        return self::ALL_AUTHORS_ID . ":" . $this->id;
34 34
     }
35 35
 
36
-    public static function getEntryIdByLetter ($startingLetter) {
37
-        return self::ALL_AUTHORS_ID.":letter:".$startingLetter;
36
+    public static function getEntryIdByLetter($startingLetter) {
37
+        return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter;
38 38
     }
39 39
 
40 40
     public static function getCount() {
41 41
         // str_format (localize("authors.alphabetical", count(array))
42
-        return Base::getCountGeneric ("authors", self::ALL_AUTHORS_ID, Base::PAGE_ALL_AUTHORS);
42
+        return Base::getCountGeneric("authors", self::ALL_AUTHORS_ID, Base::PAGE_ALL_AUTHORS);
43 43
     }
44 44
 
45 45
     public static function getAllAuthorsByFirstLetter() {
46
-        list (, $result) = Base::executeQuery ("select {0}
46
+        list (, $result) = Base::executeQuery("select {0}
47 47
 from authors
48 48
 group by substr (upper (sort), 1, 1)
49
-order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1);
49
+order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array(), -1);
50 50
         $entryArray = array();
51
-        while ($post = $result->fetchObject ())
51
+        while ($post = $result->fetchObject())
52 52
         {
53
-            array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
54
-                str_format (localize("authorword", $post->count), $post->count), "text",
55
-                array ( new LinkNavigation ("?page=".Base::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count));
53
+            array_push($entryArray, new Entry($post->title, Author::getEntryIdByLetter($post->title),
54
+                str_format(localize("authorword", $post->count), $post->count), "text",
55
+                array(new LinkNavigation("?page=" . Base::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))), "", $post->count));
56 56
         }
57 57
         return $entryArray;
58 58
     }
59 59
 
60 60
     public static function getAuthorsByStartingLetter($letter) {
61
-        return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));
61
+        return self::getEntryArray(self::SQL_AUTHORS_BY_FIRST_LETTER, array($letter . "%"));
62 62
     }
63 63
 
64 64
     public static function getAuthorsForSearch($query) {
65
-        return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%"));
65
+        return self::getEntryArray(self::SQL_AUTHORS_FOR_SEARCH, array($query . "%", $query . "%"));
66 66
     }
67 67
 
68 68
     public static function getAllAuthors() {
69
-        return self::getEntryArray (self::SQL_ALL_AUTHORS, array ());
69
+        return self::getEntryArray(self::SQL_ALL_AUTHORS, array());
70 70
     }
71 71
 
72
-    public static function getEntryArray ($query, $params) {
73
-        return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author");
72
+    public static function getEntryArray($query, $params) {
73
+        return Base::getEntryArrayWithBookNumber($query, self::AUTHOR_COLUMNS, $params, "Author");
74 74
     }
75 75
 
76
-    public static function getAuthorById ($authorId) {
77
-        $result = Base::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78
-        $result->execute (array ($authorId));
79
-        $post = $result->fetchObject ();
80
-        return new Author ($post);
76
+    public static function getAuthorById($authorId) {
77
+        $result = Base::getDb()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78
+        $result->execute(array($authorId));
79
+        $post = $result->fetchObject();
80
+        return new Author($post);
81 81
     }
82 82
 
83
-    public static function getAuthorByBookId ($bookId) {
84
-        $result = Base::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
83
+    public static function getAuthorByBookId($bookId) {
84
+        $result = Base::getDb()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
85 85
 where author = authors.id
86 86
 and book = ?');
87
-        $result->execute (array ($bookId));
88
-        $authorArray = array ();
89
-        while ($post = $result->fetchObject ()) {
90
-            array_push ($authorArray, new Author ($post));
87
+        $result->execute(array($bookId));
88
+        $authorArray = array();
89
+        while ($post = $result->fetchObject()) {
90
+            array_push($authorArray, new Author($post));
91 91
         }
92 92
         return $authorArray;
93 93
     }
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
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     const ALL_RATING_ID = "cops:rating";
12 12
 
13 13
     const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count";
14
-    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
+    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";
15 15
     public $id;
16 16
     public $name;
17 17
 
@@ -20,41 +20,41 @@  discard block
 block discarded – undo
20 20
         $this->name = $pname;
21 21
     }
22 22
 
23
-    public function getUri () {
24
-        return "?page=".Base::PAGE_RATING_DETAIL."&id=$this->id";
23
+    public function getUri() {
24
+        return "?page=" . Base::PAGE_RATING_DETAIL . "&id=$this->id";
25 25
     }
26 26
 
27
-    public function getEntryId () {
28
-        return self::ALL_RATING_ID.":".$this->id;
27
+    public function getEntryId() {
28
+        return self::ALL_RATING_ID . ":" . $this->id;
29 29
     }
30 30
 
31 31
     public static function getCount() {
32 32
         // str_format (localize("ratings", count(array))
33
-        return Base::getCountGeneric ("ratings", self::ALL_RATING_ID, Base::PAGE_ALL_RATINGS, "ratings");
33
+        return Base::getCountGeneric("ratings", self::ALL_RATING_ID, Base::PAGE_ALL_RATINGS, "ratings");
34 34
     }
35 35
 
36 36
     public static function getAllRatings() {
37
-        return self::getEntryArray (self::SQL_ALL_RATINGS, array ());
37
+        return self::getEntryArray(self::SQL_ALL_RATINGS, array());
38 38
     }
39 39
 
40
-    public static function getEntryArray ($query, $params) {
41
-        list (, $result) = Base::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1);
40
+    public static function getEntryArray($query, $params) {
41
+        list (, $result) = Base::executeQuery($query, self::RATING_COLUMNS, "", $params, -1);
42 42
         $entryArray = array();
43
-        while ($post = $result->fetchObject ())
43
+        while ($post = $result->fetchObject())
44 44
         {
45
-            $ratingObj = new Rating ($post->id, $post->rating);
46
-            $rating=$post->rating/2;
47
-            $rating = str_format (localize("ratingword", $rating), $rating);
48
-            array_push ($entryArray, new Entry ($rating, $ratingObj->getEntryId (),
49
-                str_format (localize("bookword", $post->count), $post->count), "text",
50
-                array ( new LinkNavigation ($ratingObj->getUri ())), "", $post->count));
45
+            $ratingObj = new Rating($post->id, $post->rating);
46
+            $rating = $post->rating / 2;
47
+            $rating = str_format(localize("ratingword", $rating), $rating);
48
+            array_push($entryArray, new Entry($rating, $ratingObj->getEntryId(),
49
+                str_format(localize("bookword", $post->count), $post->count), "text",
50
+                array(new LinkNavigation($ratingObj->getUri())), "", $post->count));
51 51
         }
52 52
         return $entryArray;
53 53
     }
54 54
 
55
-    public static function getRatingById ($ratingId) {
56
-        $result = Base::getDb ()->prepare('select rating from ratings where id = ?');
57
-        $result->execute (array ($ratingId));
58
-        return new Rating ($ratingId, $result->fetchColumn ());
55
+    public static function getRatingById($ratingId) {
56
+        $result = Base::getDb()->prepare('select rating from ratings where id = ?');
57
+        $result->execute(array($ratingId));
58
+        return new Rating($ratingId, $result->fetchColumn());
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
epubreader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
 
16 16
 $idData = getURLParam('data', NULL);
17 17
 $add = 'data=' . $idData . '&';
18
-if (!is_null (GetUrlParam (DB))) {
19
-    $add .= DB . '=' . GetUrlParam (DB) . '&';
18
+if (!is_null(GetUrlParam(DB))) {
19
+    $add .= DB . '=' . GetUrlParam(DB) . '&';
20 20
 }
21 21
 $myBook = Book::getBookByDataId($idData);
22 22
 
Please login to merge, or discard this patch.