private function getCoverFromEContent() { if ($this->configArray['EContent']['library'] && isset($this->id) && is_numeric($this->id)) { $this->log("Looking for eContent Cover", PEAR_LOG_INFO); $this->initMemcache(); $this->log("Checking eContent database to see if there is a record for {$this->id}", PEAR_LOG_INFO); //Check the database to see if there is an existing title require_once ROOT_DIR . '/sys/eContent/EContentRecord.php'; $epubFile = new EContentRecord(); $epubFile->id = $this->id; if ($epubFile->find(true)) { $this->log("Found an eContent record for {$this->id}, source is {$epubFile->source}", PEAR_LOG_INFO); //Get the cover for the epub if one exists. if (strcasecmp($epubFile->source, 'OverDrive') == 0 && ($epubFile->cover == null || strlen($epubFile->cover) == 0)) { $this->log("Record is an OverDrive record that needs cover information fetched.", PEAR_LOG_INFO); //Get the image from OverDrive require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php'; $overDriveDriver = OverDriveDriverFactory::getDriver(); $filename = $overDriveDriver->getCoverUrl($epubFile); $this->log("Got OverDrive cover information for {$epubFile->id} {$epubFile->sourceUrl}", PEAR_LOG_INFO); $this->log("Received filename {$filename}", PEAR_LOG_INFO); if ($filename != null) { $epubFile->cover = $filename; $ret = $epubFile->update(); //Don't update solr for performance reasons $this->log("Result of saving cover url is {$ret}", PEAR_LOG_INFO); } } elseif (preg_match('/Colorado State Gov\\. Docs/si', $epubFile->source) == 1 || $epubFile->source == 'CO State Gov Docs') { //Cover is colorado state flag $this->log("Record is a gov docs file.", PEAR_LOG_INFO); $themeName = $this->configArray['Site']['theme']; $filename = "interface/themes/{$themeName}/images/state_flag_of_colorado.png"; if ($this->processImageURL($filename, true)) { return; } } if ($epubFile->cover && strlen($epubFile->cover) > 0) { $this->log("Cover for the file is specified as {$epubFile->cover}.", PEAR_LOG_INFO); if (strpos($epubFile->cover, 'http://') === 0) { $filename = $epubFile->cover; if ($this->processImageURL($filename, true)) { $this->timer->writeTimings(); exit; } } else { $filename = $this->bookCoverPath . '/original/' . $epubFile->cover; $this->localFile = $this->bookCoverPath . '/' . $this->size . '/' . $this->cacheName . '.png'; if (file_exists($filename)) { if ($this->processImageURL($filename, true)) { $this->timer->writeTimings(); exit; } } else { $this->log("Did not find econtent cover file {$filename}", PEAR_LOG_ERR); } } } } } $this->log("Did not find a cover based on eContent information.", PEAR_LOG_INFO); }
if (empty($timer)) { $timer = new Timer(microtime(false)); } // Retrieve values from configuration file require_once ROOT_DIR . '/sys/ConfigArray.php'; $configArray = readConfig(); $timer->logTime("Read config"); if (isset($configArray['System']['timings'])) { $timer->enableTimings($configArray['System']['timings']); } //Start a logger $logger = new Logger(); //Update error handling if ($configArray['System']['debug']) { ini_set('display_errors', true); error_reporting(E_ALL & ~E_DEPRECATED); } date_default_timezone_set($configArray['Site']['timezone']); $timer->logTime("bootstrap"); //Create the QR Code if it doesn't exit $type = $_REQUEST['type']; $id = $_REQUEST['id']; $filename = $configArray['Site']['qrcodePath'] . "/{$type}_{$id}.png"; if (!file_exists($filename)) { include ROOT_DIR . '/sys/phpqrcode/qrlib.php'; $codeContents = $configArray['Site']['url'] . "/{$type}/{$id}/Home"; QRcode::png($codeContents, $filename, QR_ECLEVEL_L, 3); } readfile($filename); $timer->writeTimings();