@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | const COMPATIBILITY_XML_ALDIKO = "aldiko"; |
| 37 | 37 | |
| 38 | - private static $db = NULL; |
|
| 38 | + private static $db = null; |
|
| 39 | 39 | |
| 40 | 40 | public static function isMultipleDatabaseEnabled () { |
| 41 | 41 | global $config; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public static function getDbName ($database = NULL) { |
|
| 74 | + public static function getDbName ($database = null) { |
|
| 75 | 75 | global $config; |
| 76 | 76 | if (self::isMultipleDatabaseEnabled ()) { |
| 77 | 77 | if (is_null ($database)) $database = GetUrlParam (DB, 0); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return ""; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public static function getDbDirectory ($database = NULL) { |
|
| 87 | + public static function getDbDirectory ($database = null) { |
|
| 88 | 88 | global $config; |
| 89 | 89 | if (self::isMultipleDatabaseEnabled ()) { |
| 90 | 90 | if (is_null ($database)) $database = GetUrlParam (DB, 0); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // -DC- Add image directory |
| 101 | - public static function getImgDirectory ($database = NULL) { |
|
| 101 | + public static function getImgDirectory ($database = null) { |
|
| 102 | 102 | global $config; |
| 103 | 103 | if (self::isMultipleDatabaseEnabled ()) { |
| 104 | 104 | if (is_null ($database)) $database = GetUrlParam (DB, 0); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | return $config['image_directory']; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public static function getDbFileName ($database = NULL) { |
|
| 111 | + public static function getDbFileName ($database = null) { |
|
| 112 | 112 | return self::getDbDirectory ($database) .'metadata.db'; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | throw new Exception("Database <{$database}> not found."); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public static function getDb ($database = NULL) { |
|
| 122 | + public static function getDb ($database = null) { |
|
| 123 | 123 | if (is_null (self::$db)) { |
| 124 | 124 | try { |
| 125 | 125 | if (is_readable (self::getDbFileName ($database))) { |
@@ -150,19 +150,19 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public static function clearDb () { |
| 153 | - self::$db = NULL; |
|
| 153 | + self::$db = null; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public static function executeQuerySingle ($query, $database = NULL) { |
|
| 156 | + public static function executeQuerySingle ($query, $database = null) { |
|
| 157 | 157 | return self::getDb ($database)->query($query)->fetchColumn(); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
|
| 160 | + public static function getCountGeneric($table, $id, $pageId, $numberOfString = null) { |
|
| 161 | 161 | if (!$numberOfString) { |
| 162 | 162 | $numberOfString = $table . ".alphabetical"; |
| 163 | 163 | } |
| 164 | 164 | $count = self::executeQuerySingle ('select count(*) from ' . $table); |
| 165 | - if ($count == 0) return NULL; |
|
| 165 | + if ($count == 0) return null; |
|
| 166 | 166 | $entry = new Entry (localize($table . ".title"), $id, |
| 167 | 167 | str_format (localize($numberOfString, $count), $count), "text", |
| 168 | 168 | array ( new LinkNavigation ("?page=".$pageId)), "", $count); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return $entryArray; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 194 | + public static function executeQuery($query, $columns, $filter, $params, $n, $database = null, $numberPerPage = null) { |
|
| 195 | 195 | $totalResult = -1; |
| 196 | 196 | |
| 197 | 197 | if (useNormAndUp ()) { |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | header('Pragma: public'); |
| 24 | 24 | header('Cache-Control: max-age=' . $expires); |
| 25 | 25 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); |
| 26 | - $bookId = getURLParam('id', NULL); |
|
| 26 | + $bookId = getURLParam('id', null); |
|
| 27 | 27 | $type = getURLParam('type', 'jpg'); |
| 28 | - $idData = getURLParam('data', NULL); |
|
| 29 | - $viewOnly = getURLParam('view', FALSE); |
|
| 28 | + $idData = getURLParam('data', null); |
|
| 29 | + $viewOnly = getURLParam('view', false); |
|
| 30 | 30 | |
| 31 | 31 | if (is_null($bookId)) { |
| 32 | 32 | $book = Book::getBookByDataId($idData); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if ($post = $result->fetchObject ()) { |
| 40 | 40 | return new Tag ($post); |
| 41 | 41 | } |
| 42 | - return NULL; |
|
| 42 | + return null; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function getAllTags() { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | return Base::getEntryArrayWithBookNumber ($sql, self::TAG_COLUMNS, array (), "Tag"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 57 | + public static function getAllTagsByQuery($query, $n, $database = null, $numberPerPage = null) { |
|
| 58 | 58 | $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
| 59 | 59 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
| 60 | 60 | list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage); |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | public $seriesIndex; |
| 100 | 100 | public $comment; |
| 101 | 101 | public $rating; |
| 102 | - public $datas = NULL; |
|
| 103 | - public $authors = NULL; |
|
| 104 | - public $publisher = NULL; |
|
| 105 | - public $serie = NULL; |
|
| 106 | - public $tags = NULL; |
|
| 107 | - public $languages = NULL; |
|
| 102 | + public $datas = null; |
|
| 103 | + public $authors = null; |
|
| 104 | + public $publisher = null; |
|
| 105 | + public $serie = null; |
|
| 106 | + public $tags = null; |
|
| 107 | + public $languages = null; |
|
| 108 | 108 | public $format = array (); |
| 109 | - private $coverFileName = NULL; |
|
| 109 | + private $coverFileName = null; |
|
| 110 | 110 | |
| 111 | 111 | public function __construct($line) { |
| 112 | 112 | global $config; |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | $imgDirectory = Base::getImgDirectory(); |
| 137 | 137 | $this->coverFileName = $line->cover; |
| 138 | 138 | if (!file_exists($this->coverFileName)) { |
| 139 | - $this->coverFileName = NULL; |
|
| 139 | + $this->coverFileName = null; |
|
| 140 | 140 | } |
| 141 | 141 | if (empty($this->coverFileName)) { |
| 142 | 142 | $this->coverFileName = sprintf('%s%s', $imgDirectory, $line->cover); |
| 143 | 143 | if (!file_exists($this->coverFileName)) { |
| 144 | - $this->coverFileName = NULL; |
|
| 144 | + $this->coverFileName = null; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | if (empty($this->coverFileName)) { |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | if ($data) { |
| 150 | 150 | $this->coverFileName = sprintf('%s%s/%s', $imgDirectory, $data->name, $line->cover); |
| 151 | 151 | if (!file_exists($this->coverFileName)) { |
| 152 | - $this->coverFileName = NULL; |
|
| 152 | + $this->coverFileName = null; |
|
| 153 | 153 | } |
| 154 | 154 | if (empty($this->coverFileName)) { |
| 155 | 155 | $this->coverFileName = sprintf('%s%s.jpg', $imgDirectory, $data->name); |
| 156 | 156 | if (!file_exists($this->coverFileName)) { |
| 157 | - $this->coverFileName = NULL; |
|
| 157 | + $this->coverFileName = null; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | /* End of other class (author, series, tag, ...) initialization and accessors */ |
| 307 | 307 | |
| 308 | 308 | public static function getFilterString() { |
| 309 | - $filter = getURLParam('tag', NULL); |
|
| 309 | + $filter = getURLParam('tag', null); |
|
| 310 | 310 | if (empty($filter)) return ''; |
| 311 | 311 | |
| 312 | 312 | $exists = true; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | { |
| 329 | 329 | $bestFormatForKindle = array('EPUB', 'PDF', 'AZW3', 'MOBI'); |
| 330 | 330 | $bestRank = -1; |
| 331 | - $bestData = NULL; |
|
| 331 | + $bestData = null; |
|
| 332 | 332 | foreach ($this->getDatas() as $data) { |
| 333 | 333 | $key = array_search($data->format, $bestFormatForKindle); |
| 334 | 334 | if ($key !== false && $key > $bestRank) { |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | return reset($reduced); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - public function getFilePath($extension, $idData = NULL, $relative = false) |
|
| 398 | + public function getFilePath($extension, $idData = null, $relative = false) |
|
| 399 | 399 | { |
| 400 | 400 | /*if ($extension == 'jpg') |
| 401 | 401 | { |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | else { |
| 432 | 432 | $data = $this->getDataById($idData); |
| 433 | 433 | if (!$data) { |
| 434 | - return NULL; |
|
| 434 | + return null; |
|
| 435 | 435 | } |
| 436 | 436 | $file = $data->name . "." . strtolower($data->format); |
| 437 | 437 | return $this->path . '/' . $file; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - public function getThumbnail($width, $height, $outputfile = NULL, $inType = 'jpg') { |
|
| 481 | + public function getThumbnail($width, $height, $outputfile = null, $inType = 'jpg') { |
|
| 482 | 482 | if (is_null($width) && is_null($height)) { |
| 483 | 483 | return false; |
| 484 | 484 | } |
@@ -541,12 +541,12 @@ discard block |
||
| 541 | 541 | //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
| 542 | 542 | $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION)); |
| 543 | 543 | if ($ext == 'png') { |
| 544 | - array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_IMAGE_TYPE, "cover.png", NULL)); |
|
| 545 | - array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_THUMBNAIL_TYPE, "cover.png", NULL)); |
|
| 544 | + array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_IMAGE_TYPE, "cover.png", null)); |
|
| 545 | + array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_THUMBNAIL_TYPE, "cover.png", null)); |
|
| 546 | 546 | } |
| 547 | 547 | else { |
| 548 | - array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
| 549 | - array_push($linkArray, Data::getLink($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL)); |
|
| 548 | + array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', null)); |
|
| 549 | + array_push($linkArray, Data::getLink($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", null)); |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | $this->getLinkArray(), $this); |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - public static function getBookCount($database = NULL) { |
|
| 581 | + public static function getBookCount($database = null) { |
|
| 582 | 582 | return parent::executeQuerySingle('select count(*) from books', $database); |
| 583 | 583 | } |
| 584 | 584 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | $book = new Book($post); |
| 648 | 648 | return $book; |
| 649 | 649 | } |
| 650 | - return NULL; |
|
| 650 | + return null; |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | public static function getBookByDataId($dataId) { |
@@ -663,10 +663,10 @@ discard block |
||
| 663 | 663 | $book->datas = array($data); |
| 664 | 664 | return $book; |
| 665 | 665 | } |
| 666 | - return NULL; |
|
| 666 | + return null; |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | - public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 669 | + public static function getBooksByQuery($query, $n, $database = null, $numberPerPage = null) { |
|
| 670 | 670 | $i = 0; |
| 671 | 671 | $critArray = array(); |
| 672 | 672 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
@@ -713,11 +713,11 @@ discard block |
||
| 713 | 713 | return $entryArray; |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 716 | + public static function getBooksByStartingLetter($letter, $n, $database = null, $numberPerPage = null) { |
|
| 717 | 717 | return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage); |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 720 | + public static function getEntryArray($query, $params, $n, $database = null, $numberPerPage = null) { |
|
| 721 | 721 | /* @var $totalNumber integer */ |
| 722 | 722 | /* @var $result PDOStatement */ |
| 723 | 723 | list($totalNumber, $result) = parent::executeQuery($query, self::getBookColumns(), self::getFilterString(), $params, $n, $database, $numberPerPage); |