/** * Initiate class vars when writing NZB's. * * @param int $groupID * * @access public */ public function initiateForWrite($groupID) { $this->groupID = $groupID; // Set table names if ($this->tablePerGroup === true) { if ($this->groupID == '') { exit("{$this->groupID} is missing\n"); } $this->_tableNames = ['cName' => 'collections_' . $this->groupID, 'bName' => 'binaries_' . $this->groupID, 'pName' => 'parts_' . $this->groupID]; } else { $this->_tableNames = ['cName' => 'collections', 'bName' => 'binaries', 'pName' => 'parts']; } $this->_collectionsQuery = sprintf('SELECT %s.*, UNIX_TIMESTAMP(%s.date) AS udate, groups.name AS groupname FROM %s INNER JOIN groups ON %s.group_id = groups.id WHERE %s.releaseid = ', $this->_tableNames['cName'], $this->_tableNames['cName'], $this->_tableNames['cName'], $this->_tableNames['cName'], $this->_tableNames['cName']); $this->_binariesQuery = 'SELECT id, name, totalparts FROM ' . $this->_tableNames['bName'] . ' WHERE collection_id = %d ORDER BY name'; $this->_partsQuery = 'SELECT DISTINCT(messageid), size, partnumber FROM ' . $this->_tableNames['pName'] . ' WHERE binaryid = %d ORDER BY partnumber'; $this->_nzbHeadString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n<!-- NZB Generated by: nZEDb " . $this->pdo->version() . ' ' . htmlspecialchars(date('F j, Y, g:i a O'), ENT_QUOTES, 'utf-8') . " -->\n<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n<head>\n <meta type=\"category\">%s</meta>\n <meta type=\"name\">%s</meta>\n</head>\n\n"; }
public function version() { return $this->pdo->version(); }