function sendAdminMail($adminName, $adminEmail, $subject = '', $title = '', $content = '', $author = '', $live_site, $modifylink, $viewlink) { if (!$adminEmail) { return; } if (strpos($adminEmail, '@example.com') !== false) { return; } $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $messagetemplate = $params->get("notifymessage", JText::_('JEV_DEFAULT_NOTIFYMESSAGE')); if (strpos($messagetemplate, "JEV_DEFAULT_NOTIFYMESSAGE") !== false || trim(strip_tags($messagetemplate)) == "") { $messagetemplate = sprintf(JText::_('JEV_EMAIL_EVENT_TITLE'), "{TITLE}") . "<br/><br/>\n"; $messagetemplate .= "{DESCRIPTION}<br/><br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_MAIL_TO_ADMIN'), "{LIVESITE}", "{AUTHOR}") . "<br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_EMAIL_VIEW_EVENT'), "{VIEWLINK}") . "<br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_EMAIL_EDIT_EVENT'), "{EDITLINK}") . "<br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_MANAGE_EVENTS'), "{MANAGEEVENTS}") . "<br/>"; } $uri =& JURI::getInstance(JURI::base()); $root = $uri->toString(array('scheme', 'host', 'port')); $adminLink = $root . JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task=admin.listevents&Itemid=" . JEVHelper::getAdminItemid()); $messagetemplate = str_replace("{TITLE}", $title, $messagetemplate); $messagetemplate = str_replace("{DESCRIPTION}", $content, $messagetemplate); $messagetemplate = str_replace("{LIVESITE}", $live_site, $messagetemplate); $messagetemplate = str_replace("{AUTHOR}", $author, $messagetemplate); $messagetemplate = str_replace("{VIEWLINK}", $viewlink, $messagetemplate); $messagetemplate = str_replace("{EDITLINK}", $modifylink, $messagetemplate); $messagetemplate = str_replace("{MANAGEEVENTS}", $adminLink, $messagetemplate); // mail function $mail =& JFactory::getMailer(); $mail->setSender(array(0 => $adminEmail, 1 => $adminName)); $mail->addRecipient($adminEmail); if ($params->get("com_notifyboth")) { $jevadminuser = new JUser($params->get("jevadmin", 62)); if ($jevadminuser->email != $adminEmail) { $mail->addCC($jevadminuser->email); } } $mail->setSubject($subject); $mail->setBody($messagetemplate); $mail->IsHTML(true); $mail->send(); }
function sendAdminMail($adminName, $adminEmail, $subject = '', $title = '', $content = '', $author = '', $live_site, $modifylink, $viewlink) { if (!$adminEmail) { return; } if (strpos($adminEmail, '@example.com') !== false) { return; } $htmlmail = true; $lf = $htmlmail === true ? '<br />' : '\\r\\n'; $content = sprintf(JText::_('JEV_EMAIL_EVENT_TITLE'), $title) . $lf . $lf . $content; $content .= $lf . $lf . sprintf(JText::_('JEV_MAIL_TO_ADMIN'), $live_site, $author); $content .= $lf . sprintf(JText::_('JEV_EMAIL_VIEW_EVENT'), $viewlink); $content .= $lf . sprintf(JText::_('JEV_EMAIL_EDIT_EVENT'), $modifylink); $uri =& JURI::getInstance(JURI::base()); $root = $uri->toString(array('scheme', 'host', 'port')); $adminLink = $root . JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task=admin.listevents&Itemid=" . JEVHelper::getAdminItemid()); $content .= $lf . JText::sprintf('JEV_MANAGE_EVENTS', $adminLink); // mail function $mail =& JFactory::getMailer(); $mail->setSender(array(0 => $adminEmail, 1 => $adminName)); $mail->addRecipient($adminEmail); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("com_notifyboth")) { $jevadminuser = new JUser($params->get("jevadmin", 62)); if ($jevadminuser->email != $adminEmail) { $mail->addCC($jevadminuser->email); } } $mail->setSubject($subject); $mail->setBody($content); $mail->IsHTML(true); $mail->send(); }
<?php defined('_JEXEC') or die('Restricted access'); $cfg = JEVConfig::getInstance(); $this->data = $data = $this->datamodel->getDataForAdmin($this->creator_id, $this->limit, $this->limitstart); $frontendPublish = intval($cfg->get('com_frontendPublish', 0)) > 0; $num_events = count($data['rows']); $chdate = ''; echo '<fieldset><legend class="ev_fieldset">' . JText::_('JEV_ADMINPANEL') . '</legend><br />' . "\n"; $myItemid = JEVHelper::getAdminItemid(); $form_link = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=admin.listevents' . "&Itemid=" . $myItemid, false); ?> <form action="<?php echo $form_link; ?> " method="post"> <?php $filters = jevFilterProcessing::getInstance(array("startdate")); $filterHTML = $filters->getFilterHTML(); foreach ($filterHTML as $filter) { echo "<div class='jev_adminfilter'>" . $filter["title"] . "<br/>" . $filter["html"] . "</div>"; } ?> </form> <?php echo '<table align="center" width="90%" cellspacing="0" cellpadding="5" class="ev_table">' . "\n"; if ($num_events > 0) { for ($r = 0; $r < $num_events; $r++) { $row = $data['rows'][$r]; $event_month_year = $row->mup() . $row->yup(); if ($event_month_year != $chdate && $chdate != "") {
public static function sendAdminMail($adminName, $adminEmail, $subject = '', $title = '', $content = '', $day = '', $month = '', $year = '', $start_time = '', $end_time = '', $author = '', $live_site, $modifylink, $viewlink, $event = false, $cc = "") { if (!$adminEmail) { return; } if (strpos($adminEmail, '@example.com') !== false) { return; } $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $messagetemplate = $params->get("notifymessage", JText::_('JEV_DEFAULT_NOTIFYMESSAGE')); if (strpos($messagetemplate, "JEV_DEFAULT_NOTIFYMESSAGE") !== false || trim(strip_tags($messagetemplate)) == "") { $messagetemplate = sprintf(JText::_('JEV_EMAIL_EVENT_TITLE'), "{TITLE}") . "<br/><br/>\n"; $messagetemplate .= "{DESCRIPTION}<br/><br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_MAIL_TO_ADMIN'), "{LIVESITE}", "{AUTHOR}") . "<br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_EMAIL_VIEW_EVENT'), "{VIEWLINK}") . "<br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_EMAIL_EDIT_EVENT'), "{EDITLINK}") . "<br/>\n"; $messagetemplate .= sprintf(JText::_('JEV_MANAGE_EVENTS'), "{MANAGEEVENTS}") . "<br/>"; } $uri = JURI::getInstance(JURI::base()); $root = $uri->toString(array('scheme', 'host', 'port')); $adminLink = $root . JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task=admin.listevents&Itemid=" . JEVHelper::getAdminItemid()); $messagetemplate = str_replace("{TITLE}", $title, $messagetemplate); $messagetemplate = str_replace("{DESCRIPTION}", $content, $messagetemplate); if ($event) { $messagetemplate = str_replace("{CATEGORY}", $event->catname(), $messagetemplate); //$messagetemplate = str_replace("{EXTRA}", $event->extra_info(),$messagetemplate); } $messagetemplate = str_replace("{LIVESITE}", $live_site, $messagetemplate); $messagetemplate = str_replace("{AUTHOR}", $author, $messagetemplate); $messagetemplate = str_replace("{DAY}", $day, $messagetemplate); $messagetemplate = str_replace("{MONTH}", $month, $messagetemplate); $messagetemplate = str_replace("{YEAR}", $year, $messagetemplate); $messagetemplate = str_replace("{STARTTIME}", $start_time, $messagetemplate); $messagetemplate = str_replace("{ENDTIME}", $end_time, $messagetemplate); $messagetemplate = str_replace("{VIEWLINK}", $viewlink, $messagetemplate); $messagetemplate = str_replace("{EDITLINK}", $modifylink, $messagetemplate); $messagetemplate = str_replace("{MANAGEEVENTS}", $adminLink, $messagetemplate); // mail function $mail = JFactory::getMailer(); $mail->setSender(array(0 => $adminEmail, 1 => $adminName)); $mail->addRecipient($adminEmail); if ($params->get("com_notifyboth")) { $jevadminuser = new JUser($params->get("jevadmin", 62)); if ($jevadminuser->email != $adminEmail) { $mail->addCC($jevadminuser->email); } } if ($event) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin("jevents"); $res = $dispatcher->trigger('onSendAdminMail', array(&$mail, $event)); } $mail->setSubject($subject); $mail->setBody($messagetemplate); if ($cc != "") { $mail->addCC($cc); } $mail->IsHTML(true); $mail->send(); }