getTag(); $itemId = JRequest :: getUInt('Itemid', 0); $publicationId = JRequest :: getString('publicationId'); $recipient = JRequest :: getString('recipient'); $this -> getModel(self :: PIWIK) -> track('emailPublication', 'publicationId=' . urlencode($this -> publicationId) . '&locale=' . urlencode($locale) . '&recipient=' . urlencode($recipient)); $publication = $this -> getModel(self :: SEARCH) -> getPublication($publicationId, $locale); $this -> loadHelper('PublicationHelper'); if (($publicationId == NULL) || ($publication == NULL) || ($publication -> title == NULL)) JLog :: add('Error sending publication ' . $publicationId . ' via email to ' . $recipient . ': error retrieving publication', JLog :: ERROR, self :: LOG); else if (JUtility :: sendMail(JText :: _('EMAIL_ADDRESS'), JText :: _('OPENAIRE'), $recipient, JText :: _('OPENAIRE') . ' - ' . $publication -> title, $this -> splitLines(PublicationHelper :: formatPublication($publication, $itemId)), TRUE)) JLog :: add('Sent publication ' . $publicationId . ' via email to ' . $recipient, JLog :: INFO, self :: LOG); else JLog :: add('Error sending publication ' . $publicationId . ' via email to ' . $recipient . ': error delivering message', JLog :: ERROR, self :: LOG); $application -> redirect(JRoute :: _('index.php?option=com_openaire&view=article&Itemid=' . $itemId . '&articleId=' . $publicationId, FALSE)); return TRUE; } private function splitLines($body) { $newBody = ''; while (strlen($body) >= self :: MAX_LINE) { $line = substr($body, 0, self :: MAX_LINE); $line = substr($line, 0, strrpos($line, ' ')); $body = substr($body, strlen($line)); $newBody .= $line . "\n"; } $newBody .= $body; return $newBody; } }