Exemple #1
0
    public function registration($array)
    {
        $menu_items = icagendaMenus::iClistMenuItems();
        $itemid = JRequest::getVar('Itemid');
        $linkexist = '';
        foreach ($menu_items as $l) {
            if ($l->published == '1' && $l->id == $itemid) {
                $linkexist = '1';
            }
        }
        if (is_numeric($itemid) && $itemid != 0 && $linkexist == 1) {
            // Import params - Limit Options for User Registration
            $app = JFactory::getApplication();
            $date = JFactory::getDate();
            $params = $app->getParams();
            $isSef = $app->getCfg('sef');
            $eventTimeZone = null;
            $data = new stdClass();
            // Set the values
            $data->id = null;
            $data->eventid = '0';
            $data->userid = isset($array['uid']) ? $array['uid'] : '';
            if (isset($array['name'])) {
                $data->name = $array['name'];
            }
            $data->email = isset($array['email']) ? $array['email'] : '';
            $data->phone = isset($array['phone']) ? $array['phone'] : '';
            if (isset($array['date'])) {
                $data->date = $array['date'];
            }
            if (isset($array['period'])) {
                $data->period = $array['period'];
            }
            if (isset($array['people'])) {
                $data->people = $array['people'];
            }
            $data->notes = isset($array['notes']) ? htmlentities(strip_tags($array['notes'])) : '';
            if (isset($array['event'])) {
                $data->eventid = $array['event'];
            }
            if (isset($array['menuID'])) {
                $data->itemid = $array['menuID'];
            }
            $data->created = $date->toSql();
            $data->created_by = $data->userid;
            $current_url = isset($array['current_url']) ? $array['current_url'] : 'index.php';
            $max_nb_of_tickets = isset($array['max_nb_of_tickets']) ? $array['max_nb_of_tickets'] : '1000000';
            $tos = isset($array['tos']) ? 'checked' : '';
            $custom_fields = isset($array['custom_fields']) ? $array['custom_fields'] : false;
            //			$tickets_left		= isset($array['tickets_left']) ? $array['tickets_left'] : '1000000';
            $email2 = isset($array['email2']) ? $array['email2'] : false;
            // Filter Name
            $array['name'] = str_replace("'", '’', $array['name']);
            $array['name'] = (string) preg_replace('/[\\x00-\\x1F\\x7F]/', '', $array['name']);
            // Set Form Data to Session
            $session = JFactory::getSession();
            $session->set('ic_registration', $array);
            $session->set('ic_submit_tos', $tos);
            $custom_fields_array = isset($array['custom_fields']) ? (array) $array['custom_fields'] : array();
            $session->set('custom_fields', $custom_fields_array);
            $session->set('email2', $email2);
            // Control if still ticket left
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
            // Registrations total
            $query->select('sum(r.people) AS registered');
            $query->from('`#__icagenda_registration` AS r');
            $query->where('r.state > 0');
            $query->where('r.date = ' . $db->q($data->date));
            $query->where('r.eventid = ' . (int) $data->eventid);
            $db->setQuery($query);
            $registered = $db->loadObject()->registered;
            $data->checked_out_time = date('Y-m-d H:i:s');
            // Set Date in url
            $datesDisplay = $params->get('datesDisplay', 1);
            $date_alias = $data->date ? iCDate::dateToAlias(date('Y-m-d H:i', strtotime($data->date))) : false;
            $date_var = $isSef == 1 ? '?date=' : '&date=';
            $this_date = $date_alias ? $date_var . $date_alias : '';
            $dateInUrl = $datesDisplay === 1 ? $this_date : '';
            // Get the "event" URL
            $baseURL = JURI::base();
            $subpathURL = JURI::base(true);
            $baseURL = str_replace('/administrator', '', $baseURL);
            $subpathURL = str_replace('/administrator', '', $subpathURL);
            // Sub Path filtering
            $subpathURL = ltrim($subpathURL, '/');
            // URL Event Details filtering
            $urlEvent = str_replace('&', '&', JRoute::_('index.php?option=com_icagenda&view=list&layout=event&Itemid=' . (int) $data->itemid . '&id=' . (int) $data->eventid)) . $dateInUrl;
            $urlEvent = ltrim($urlEvent, '/');
            if (substr($urlEvent, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
                $urlEvent = substr($urlEvent, strlen($subpathURL) + 1);
            }
            $urlEvent = rtrim($baseURL, '/') . '/' . ltrim($urlEvent, '/');
            // URL List filtering
            $urlList = str_replace('&', '&', JRoute::_('index.php?option=com_icagenda&view=list&Itemid=' . (int) $data->itemid));
            $urlList = ltrim($urlList, '/');
            if (substr($urlList, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
                $urlList = substr($urlList, strlen($subpathURL) + 1);
            }
            $urlList = rtrim($baseURL, '/') . '/' . ltrim($urlList, '/');
            // URL Registration filtering // NOT USED
            $urlRegistration = str_replace('&', '&', JRoute::_('index.php?option=com_icagenda&view=list&layout=registration&Itemid=' . (int) $data->itemid . '&id=' . (int) $data->eventid));
            $urlRegistration = ltrim($urlRegistration, '/');
            if (substr($urlRegistration, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
                $urlRegistration = substr($urlRegistration, strlen($subpathURL) + 1);
            }
            $urlRegistration = rtrim($baseURL, '/') . '/' . ltrim($urlRegistration, '/');
            // URL Payment filtering
            $urlPayment = str_replace('&', '&', JRoute::_('index.php?option=com_icagenda&view=list&layout=actions&Itemid=' . (int) $data->itemid . '&id=' . (int) $data->eventid));
            $urlPayment = ltrim($urlPayment, '/');
            if (substr($urlPayment, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
                $urlPayment = substr($urlPayment, strlen($subpathURL) + 1);
            }
            $urlPayment = rtrim($baseURL, '/') . '/' . ltrim($urlPayment, '/');
            $urlPayment = $urlPayment . '?status=payment';
            // Check number of tickets left
            $tickets_left = $max_nb_of_tickets - $registered;
            // IF NO TICKETS LEFT
            if ($tickets_left <= 0) {
                $app->enqueueMessage(JText::_('COM_ICAGENDA_ALERT_NO_TICKETS_AVAILABLE'), 'warning');
                $app->redirect(htmlspecialchars_decode($urlEvent));
            } elseif ($tickets_left < $data->people) {
                $msg = JText::_('COM_ICAGENDA_ALERT_NOT_ENOUGH_TICKETS_AVAILABLE') . '<br />';
                $msg .= JText::sprintf('COM_ICAGENDA_ALERT_NOT_ENOUGH_TICKETS_AVAILABLE_NOW', $tickets_left) . '<br />';
                $msg .= JText::_('COM_ICAGENDA_ALERT_NOT_ENOUGH_TICKETS_AVAILABLE_CHANGE_NUMBER');
                $app->enqueueMessage($msg, 'error');
                $app->redirect(htmlspecialchars_decode($current_url));
            }
            // CONTROL NAME VALUE
            $name_isValid = '1';
            //			$pattern = "#[/\\\\/\<>/\"%;=\[\]\+()&]|^[0-9]#i";
            $pattern = "#[/\\\\/\\<>/\";=\\[\\]\\+()%&]#i";
            if ($array['name']) {
                $nbMatches = preg_match($pattern, $array['name']);
                // Name contains invalid characters
                if ($nbMatches && $nbMatches == 1) {
                    $name_isValid = '0';
                    $app->enqueueMessage(JText::sprintf('COM_ICAGENDA_REGISTRATION_NAME_NOT_VALID', '<b>' . htmlentities($array['name'], ENT_COMPAT, 'UTF-8') . '</b>'), 'error');
                }
                // Name is less than 2 characters
                if (strlen(utf8_decode($array['name'])) < 2) {
                    $name_isValid = '0';
                    $app->enqueueMessage(JText::_('COM_ICAGENDA_REGISTRATION_NAME_MINIMUM_CHARACTERS'), 'error');
                }
            } else {
                $app->enqueueMessage(JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED') . ' ' . JText::_('ICAGENDA_REGISTRATION_FORM_NAME'), 'error');
            }
            $data->name = filter_var($data->name, FILTER_SANITIZE_STRING);
            // CONTROL EMAIL VALUE
            $emailRequired = $params->get('emailRequired', 1);
            $emailConfirm = $params->get('emailConfirm', 1);
            // Check if Email not empty
            if ($emailRequired && !$data->email) {
                $app->enqueueMessage(JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED') . ' ' . JText::_('ICAGENDA_REGISTRATION_FORM_EMAIL'), 'error');
            }
            // Check if Confirm Email equals Email
            if ($emailConfirm && empty($data->userid) && $data->email != $email2) {
                $app->enqueueMessage(JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_INVALID') . ' ' . JText::_('IC_FORM_EMAIL_CONFIRM_LBL') . '<br />' . JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_EMAIL2_MESSAGE'), 'error');
            }
            // Advanced Checkdnsrr email
            $emailCheckdnsrr = JComponentHelper::getParams('com_icagenda')->get('emailCheckdnsrr', '0');
            if (!empty($data->email)) {
                $validEmail = true;
                $checkdnsrr = true;
                if ($emailCheckdnsrr == 1 and function_exists('checkdnsrr')) {
                    $provider = explode('@', $data->email);
                    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                        if (version_compare(phpversion(), '5.3.0', '<')) {
                            $checkdnsrr = true;
                        }
                    } else {
                        $checkdnsrr = checkdnsrr($provider[1]);
                    }
                } else {
                    $checkdnsrr = true;
                }
            } else {
                $checkdnsrr = true;
            }
            // Check if valid email address
            $validEmail = $validEmail ? $this->validEmail($data->email) : false;
            if (!$checkdnsrr || !$validEmail && $data->email) {
                // message if email is invalid
                $app->enqueueMessage(JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_NOT_VALID'), 'error');
            }
            $eventid = $data->eventid;
            $period = isset($data->period) ? $data->period : '0';
            $people = $data->people;
            $name = $data->name;
            $email = $data->email;
            $phone = $data->phone;
            $notes = html_entity_decode($data->notes);
            $dateReg = $data->date;
            $limitRegEmail = $params->get('limitRegEmail', 1);
            $limitRegDate = $params->get('limitRegDate', 1);
            $alreadyexist = 'no';
            if ($limitRegEmail == 1 || $limitRegDate == 1) {
                $cf = JRequest::getString('email', '', 'post');
                if ($limitRegDate == 0) {
                    $query = "\n\t\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\t\tFROM `#__icagenda_registration`\n\t\t\t\t\t\tWHERE `email` = '{$cf}' AND `eventid`='{$eventid}' AND `state`='1'\n\t\t\t\t\t";
                } elseif ($limitRegDate == 1) {
                    $query = "\n\t\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\t\tFROM `#__icagenda_registration`\n\t\t\t\t\t\tWHERE `email` = '{$cf}' AND `eventid`='{$eventid}' AND `date`='{$dateReg}' AND `state`='1'\n\t\t\t\t\t";
                }
                $db->setQuery($query);
                if ($email != NULL) {
                    if ($db->loadResult()) {
                        $alreadyexist = 'yes';
                        $app->enqueueMessage(JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_ALERT') . ' ' . $email, 'error');
                    } else {
                        $alreadyexist = 'no';
                    }
                }
            }
            $email = $email ? $email : JText::_('COM_ICAGENDA_NOT_SPECIFIED');
            // Check if Phone not empty
            $phoneRequired = $params->get('phoneRequired', 1);
            if ($phoneRequired && !$phone) {
                $app->enqueueMessage(JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED') . ' ' . JText::_('ICAGENDA_REGISTRATION_FORM_PHONE'), 'error');
            }
            $phone = $phone ? $phone : JText::_('COM_ICAGENDA_NOT_SPECIFIED');
            // Check if Custom Fields required not empty
            $customfields_list = icagendaCustomfields::getListCustomFields($data->id, 1, 1);
            if ($customfields_list) {
                foreach ($customfields_list as $cf) {
                    if ($cf->cf_required == 1) {
                        if ($custom_fields[$cf->cf_slug] == '') {
                            $app->enqueueMessage(JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED') . ' ' . $cf->cf_title, 'error');
                        }
                    }
                }
            }
            // Check if ToS not checked
            if (!$tos) {
                $app->enqueueMessage(JText::_('COM_ICAGENDA_TERMS_AND_CONDITIONS_NOT_CHECKED_REGISTRATION'), 'error');
            }
            // RECAPTCHA
            $captcha_plugin = $params->get('captcha') ? $params->get('captcha') : $app->getCfg('captcha');
            $reg_captcha = JComponentHelper::getParams('com_icagenda')->get('reg_captcha', 1);
            if ($captcha_plugin && $reg_captcha != '0') {
                JPluginHelper::importPlugin('captcha');
                // JOOMLA 3.x/2.5 SWITCH
                if (version_compare(JVERSION, '3.0', 'ge')) {
                    $dispatcher = JEventDispatcher::getInstance();
                } else {
                    $dispatcher = JDispatcher::getInstance();
                }
                $res = $dispatcher->trigger('onCheckAnswer', $array['recaptcha_response_field']);
                if (!$res[0]) {
                    // message if captcha is invalid
                    $app->enqueueMessage(JText::_('PLG_RECAPTCHA_ERROR_INCORRECT_CAPTCHA_SOL'), 'error');
                }
            }
            // Get the message queue
            $error_messages = $app->getMessageQueue();
            if (count($error_messages)) {
                $app->redirect(htmlspecialchars_decode($current_url));
                return false;
            }
            // clear the data so we don't process it again
            $session->clear('ic_registration');
            $session->clear('custom_fields');
            $session->clear('ic_submit_tos');
            $session->clear('email2');
            /**
             *	SAVE REGISTRATION DATA TO DATABASE
             */
            // Option Email required
            if ($emailRequired == '1') {
                if (is_numeric($eventid) && is_numeric($period) && is_numeric($people) && $name != NULL && $email != NULL) {
                    $db->insertObject('#__icagenda_registration', $data, id);
                }
            } else {
                if (is_numeric($eventid) && is_numeric($period) && is_numeric($people) && $name != NULL) {
                    $db->insertObject('#__icagenda_registration', $data, id);
                }
            }
            /**
             *	SAVE CUSTOM FIELDS TO DATABASE
             */
            if ($custom_fields && is_array($custom_fields)) {
                icagendaCustomfields::saveToData($custom_fields, $data->id, 1);
            }
            /**
             *	NOTIFICATION EMAILS
             */
            $author = '0';
            // Preparing the query
            $query = $db->getQuery(true);
            $query->select('e.title AS title, e.startdate AS startdate, e.enddate AS enddate,
					e.created_by AS authorID, e.email AS contactemail, e.displaytime AS displaytime')->from('#__icagenda_events AS e')->where("(e.id={$data->eventid})");
            $db->setQuery($query);
            $title = $db->loadObject()->title;
            $startdate = $db->loadObject()->startdate;
            $enddate = $db->loadObject()->enddate;
            $authorID = $db->loadObject()->authorID;
            $contactemail = $db->loadObject()->contactemail;
            $displayTime = $db->loadObject()->displaytime;
            $startD = $this->formatDate($startdate);
            $endD = $this->formatDate($enddate);
            $startT = JHtml::date($startdate, 'H:i', $eventTimeZone);
            $endT = JHtml::date($enddate, 'H:i', $eventTimeZone);
            $regDate = $this->formatDate($data->date);
            $regTime = JHtml::date($data->date, 'H:i', $eventTimeZone);
            $regDateTime = !empty($displayTime) ? $regDate . ' - ' . $regTime : $regDate;
            $regStartDateTime = !empty($displayTime) ? $startD . ' - ' . $startT : $startD;
            $regEndDateTime = !empty($displayTime) ? $endD . ' - ' . $endT : $endD;
            $periodreg = $data->period;
            $defaultemail = $params->get('regEmailUser', '1');
            $emailUserSubjectPeriod = $params->get('emailUserSubjectPeriod', '');
            $emailUserBodyPeriod = $params->get('emailUserBodyPeriod', '');
            $emailUserSubjectDate = $params->get('emailUserSubjectDate', '');
            $emailUserBodyDate = $params->get('emailUserBodyDate', '');
            $emailAdminSend = $params->get('emailAdminSend', '1');
            $emailAdminSend_select = $params->get('emailAdminSend_select', array('0'));
            $emailAdminSend_custom = $params->get('emailAdminSend_Placeholder', '');
            $emailUserSend = $params->get('emailUserSend', '1');
            $eUSP = isset($emailUserSubjectPeriod) ? $emailUserSubjectPeriod : JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_PERIOD_DEFAULT_SUBJECT');
            $eUBP = isset($emailUserBodyPeriod) ? $emailUserBodyPeriod : JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_PERIOD_DEFAULT_BODY');
            $eUSD = isset($emailUserSubjectDate) ? $emailUserSubjectDate : JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_SUBJECT');
            $eUBD = isset($emailUserBodyDate) ? $emailUserBodyDate : JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_BODY');
            $period_set = substr($startdate, 0, 4);
            if ($periodreg == 1 || $array['date'] == '' && !$periodreg) {
                $periodd = $period_set != '0000' ? JText::sprintf('COM_ICAGENDA_REGISTERED_EVENT_PERIOD', $startD, $startT, $endD, $endT) : '';
                $adminsubject = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_ADMIN_DEFAULT_SUBJECT');
                $adminbody = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_ADMIN_PERIOD_DEFAULT_BODY');
                if ($defaultemail == 0) {
                    $subject = $eUSP;
                    $body = $eUBP;
                } else {
                    $subject = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_PERIOD_DEFAULT_SUBJECT');
                    $body = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_PERIOD_DEFAULT_BODY');
                }
            } else {
                //				$periodd		= ($period_set != '0000')
                //								? JText::sprintf( 'COM_ICAGENDA_REGISTERED_EVENT_DATE', $regDate, '' )
                //								: '';
                $periodd = JText::sprintf('COM_ICAGENDA_REGISTERED_EVENT_DATE', $regDate, '');
                $adminsubject = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_ADMIN_DEFAULT_SUBJECT');
                $adminbody = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_ADMIN_DATE_DEFAULT_BODY');
                if ($defaultemail == 0) {
                    $subject = $eUSD;
                    $body = $eUBD;
                } else {
                    $subject = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_SUBJECT');
                    $body = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_BODY');
                }
            }
            // Get the site name
            $sitename = $app->getCfg('sitename');
            $siteURL = JURI::base();
            $siteURL = rtrim($siteURL, '/');
            // Get Author Email
            $authormail = '';
            if ($authorID != NULL) {
                // Preparing the query
                $query = $db->getQuery(true);
                $query->select('email AS authormail, name AS authorname')->from('#__users AS u')->where("(u.id={$authorID})");
                $db->setQuery($query);
                $authormail = $db->loadObject()->authormail;
                $authorname = $db->loadObject()->authorname;
                if ($authormail == NULL) {
                    $authormail = $app->getCfg('mailfrom');
                }
            }
            // Generates filled custom fields into email body
            $customfields = icagendaCustomfields::getListNotEmpty($data->id);
            $custom_fields = '';
            $newline = $defaultemail == '0' ? "<br />" : "\n";
            if ($customfields) {
                foreach ($customfields as $customfield) {
                    $cf_value = isset($customfield->cf_value) ? $customfield->cf_value : JText::_('IC_NOT_SPECIFIED');
                    $custom_fields .= $customfield->cf_title . ": " . $cf_value . $newline;
                }
            }
            // MAIL REPLACEMENTS
            $replacements = array("\\n" => "\n", '[SITENAME]' => $sitename, '[SITEURL]' => $siteURL, '[AUTHOR]' => $authorname, '[AUTHOREMAIL]' => $authormail, '[CONTACTEMAIL]' => $contactemail, '[TITLE]' => $title, '[EVENTURL]' => $urlEvent, '[NAME]' => $name, '[EMAIL]' => $email, '[PHONE]' => $phone, '[PLACES]' => $people, '[CUSTOMFIELDS]' => $custom_fields, '[NOTES]' => $notes, '[DATE]' => $regDate, '[TIME]' => $regTime, '[DATETIME]' => $regDateTime, '[STARTDATE]' => $startD, '[ENDDATE]' => $endD, '[STARTDATETIME]' => $regStartDateTime, '[ENDDATETIME]' => $regEndDateTime, '&nbsp;' => ' ');
            foreach ($replacements as $key => $value) {
                $subject = str_replace($key, $value, $subject);
                $body = str_replace($key, $value, $body);
                $adminsubject = str_replace($key, $value, $adminsubject);
                $adminbody = str_replace($key, $value, $adminbody);
            }
            // Set Sender of USER and ADMIN emails
            $mailer = JFactory::getMailer();
            $adminmailer = JFactory::getMailer();
            $mailfrom = $app->getCfg('mailfrom');
            $fromname = $app->getCfg('fromname');
            $mailer->setSender(array($mailfrom, $fromname));
            $adminmailer->setSender(array($mailfrom, $fromname));
            // Set Recipient of USER email
            $user = JFactory::getUser();
            if (!isset($data->email)) {
                $recipient = $user->email;
            } else {
                $recipient = $data->email;
            }
            $mailer->addRecipient($recipient);
            // Set Recipient of ADMIN email
            $admin_array = array();
            if (in_array('0', $emailAdminSend_select)) {
                array_push($admin_array, $mailfrom);
            }
            if (in_array('1', $emailAdminSend_select)) {
                array_push($admin_array, $authormail);
            }
            if (in_array('2', $emailAdminSend_select)) {
                $customs_emails = explode(',', $emailAdminSend_custom);
                $customs_emails = str_replace(' ', '', $customs_emails);
                foreach ($customs_emails as $cust_mail) {
                    array_push($admin_array, $cust_mail);
                }
            }
            if (in_array('3', $emailAdminSend_select)) {
                array_push($admin_array, $contactemail);
            }
            $adminrecipient = $admin_array;
            $adminmailer->addRecipient($adminrecipient);
            // Set Subject of USER and ADMIN email
            $mailer->setSubject($subject);
            $adminmailer->setSubject($adminsubject);
            // Set Body of USER and ADMIN email
            if ($defaultemail == 0) {
                // HTML custom notification email send to user
                $mailer->isHTML(true);
                $mailer->Encoding = 'base64';
            }
            $adminbody = str_replace("<br />", "\n", $adminbody);
            $mailer->setBody($body);
            $adminmailer->setBody($adminbody);
            // Optional file attached
            //			$mailer->addAttachment(JPATH_COMPONENT.DS.'assets'.DS.'document.pdf');
            // Send USER email confirmation, if enabled
            if ($emailUserSend == 1 && isset($data->email)) {
                $send = $mailer->Send();
            }
            // Send ADMIN email notification, if enabled
            if ($emailAdminSend == 1) {
                if ($emailAdminSend == 1 && isset($data->eventid) && $data->eventid != '0' && $data->name != NULL) {
                    $sendadmin = $adminmailer->Send();
                }
            }
            $evtParams = $this->evtParams($i);
            $reg_payment = $evtParams->get('icpayment', '');
            $iCpaymentPlugin = JPluginHelper::getPlugin('content', 'ic_payment');
            if ($iCpaymentPlugin) {
                $plgParams = new JRegistry($iCpaymentPlugin->params);
                $reg_payment = $reg_payment ? $reg_payment : $plgParams->get('icpayment', '');
            }
            if ($alreadyexist == 'no') {
                $thank_you = JText::_('COM_ICAGENDA_REGISTRATION_TY') . ' ' . $data->name;
                $thank_you .= ', ' . JText::sprintf('COM_ICAGENDA_REGISTRATION', $title);
                $thank_you .= '<br />' . $periodd . ' (<a href="' . $urlEvent . '">' . JText::_('COM_ICAGENDA_REGISTRATION_EVENT_LINK') . '</a>)';
                // redirect after successful registration
                $app->enqueueMessage($thank_you, 'message');
                if ($reg_payment) {
                    $app->redirect(htmlspecialchars_decode($urlPayment));
                } else {
                    $app->redirect(htmlspecialchars_decode($urlList));
                }
            }
        } else {
            JError::raiseError('404', JTEXT::_('JERROR_LAYOUT_PAGE_NOT_FOUND'));
            return false;
        }
    }
Exemple #2
0
    function getStamp($params)
    {
        $iCparams = JComponentHelper::getParams('com_icagenda');
        $eventTimeZone = null;
        // Itemid Request (automatic detection of the first iCagenda menu-link, by menuID)
        $iC_list_menus = icagendaMenus::iClistMenuItemsInfo();
        $nb_menu = count($iC_list_menus);
        $nolink = $nb_menu ? false : true;
        $app = JFactory::getApplication();
        $menu = $app->getMenu();
        $isSef = $app->getCfg('sef');
        $date_var = $isSef == 1 ? '?date=' : '&amp;date=';
        // Check if GD is enabled on the server
        if (extension_loaded('gd') && function_exists('gd_info')) {
            $thumb_generator = $iCparams->get('thumb_generator', 1);
        } else {
            $thumb_generator = 0;
        }
        $datetime_today = JHtml::date('now', 'Y-m-d H:i');
        $timeformat = $iCparams->get('timeformat', 1);
        $lang_time = $timeformat == 1 ? 'H:i' : 'h:i A';
        // Check if fopen is allowed
        $result = ini_get('allow_url_fopen');
        $fopen = empty($result) ? false : true;
        $this->start($params);
        // Get the database
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        // Build the query
        $query->select('e.*,
				e.place as place_name,
				c.title as cat_title,
				c.alias as cat_alias,
				c.color as cat_color,
				c.ordering as cat_order
			')->from($db->qn('#__icagenda_events') . ' AS e')->leftJoin($db->qn('#__icagenda_category') . ' AS c ON ' . $db->qn('c.id') . ' = ' . $db->qn('e.catid'));
        // Where Category is Published
        $query->where('c.state = 1');
        // Where State is Published
        $query->where('e.state = 1');
        // Where event is Approved
        $query->where('e.approval = 0');
        // Add filters
        if (isset($this->filter)) {
            foreach ($this->filter as $filter) {
                $query->where($filter);
            }
        }
        // Check Access Levels
        $user = JFactory::getUser();
        $userID = $user->id;
        $userLevels = $user->getAuthorisedViewLevels();
        if (version_compare(JVERSION, '3.0', 'lt')) {
            $userGroups = $user->getAuthorisedGroups();
        } else {
            $userGroups = $user->groups;
        }
        $userAccess = implode(', ', $userLevels);
        if (!in_array('8', $userGroups)) {
            $query->where('e.access IN (' . $userAccess . ')');
        }
        // Features - extract the number of displayable icons per event
        $query->select('feat.count AS features');
        $sub_query = $db->getQuery(true);
        $sub_query->select('fx.event_id, COUNT(*) AS count');
        $sub_query->from('`#__icagenda_feature_xref` AS fx');
        $sub_query->innerJoin("`#__icagenda_feature` AS f ON fx.feature_id=f.id AND f.state=1 AND f.icon<>'-1'");
        $sub_query->group('fx.event_id');
        $query->leftJoin('(' . (string) $sub_query . ') AS feat ON e.id=feat.event_id');
        // Registrations total
        $query->select('r.count AS registered, r.date AS reg_date');
        $sub_query = $db->getQuery(true);
        $sub_query->select('r.eventid, sum(r.people) AS count, r.date AS date');
        $sub_query->from('`#__icagenda_registration` AS r');
        $sub_query->where('r.state > 0');
        $sub_query->group('r.eventid');
        $query->leftJoin('(' . (string) $sub_query . ') AS r ON e.id=r.eventid');
        // Run the query
        $db->setQuery($query);
        // Invoke the query
        $result = $db->loadObjectList();
        $registrations = icagendaEventsData::registeredList();
        foreach ($result as $record) {
            $record_registered = array();
            foreach ($registrations as $reg_by_event) {
                $ex_reg_by_event = explode('@@', $reg_by_event);
                if ($ex_reg_by_event[0] == $record->id) {
                    $record_registered[] = $ex_reg_by_event[0] . '@@' . $ex_reg_by_event[1] . '@@' . $ex_reg_by_event[2];
                }
            }
            $record->registered = $record_registered;
        }
        // Set start/end dates of the current month
        $days = self::getNbOfDaysInMonth($this->date_start);
        $current_date_start = $this->date_start;
        $month_start = date('m', strtotime($current_date_start));
        $month_end = date('m', strtotime('+1 month', strtotime($current_date_start)));
        $day_end = date('m', strtotime('+' . $days . ' days', strtotime($current_date_start)));
        $year_end = $month_start == '12' ? date('Y', strtotime("+1 year", strtotime($this->date_start))) : date('Y', strtotime($this->date_start));
        $current_date_end = $year_end . '-' . $month_end . '-' . $day_end;
        $days = $this->getDays($this->date_start, 'Y-m-d H:i');
        $total_items = 0;
        $displayed_items = 0;
        foreach ($result as $item) {
            // Extract the feature details, if needed
            $features = array();
            if (is_null($item->features) || empty($this->features_icon_size)) {
                $item->features = array();
            } else {
                $item->features = icagendaEvents::featureIcons($item->id);
            }
            if (isset($item->features) && is_array($item->features)) {
                foreach ($item->features as $feature) {
                    $features[] = array('icon' => $feature->icon, 'icon_alt' => $feature->icon_alt);
                }
            }
            // list calendar dates
            $AllDates = array();
            $next = isset($next) ? $next : '';
            $allSingleDates_array = $this->getDatelist($item->dates, $next);
            // If Single Dates, added to all dates for this event
            if (isset($datemultiplelist) && $datemultiplelist != NULL && is_array($datemultiplelist)) {
                $allSingleDates_array = array_merge($AllDates, $datemultiplelist);
            }
            foreach ($allSingleDates_array as $sd) {
                $this_date = JHtml::date($sd, 'Y-m-d', null);
                if (strtotime($this_date) >= strtotime($current_date_start) && strtotime($this_date) < strtotime($current_date_end)) {
                    array_push($AllDates, $sd);
                }
            }
            // Get WeekDays Array
            $WeeksDays = iCDatePeriod::weekdaysToArray($item->weekdays);
            // Get Period Dates
            $StDate = JHtml::date($item->startdate, 'Y-m-d H:i', $eventTimeZone);
            $EnDate = JHtml::date($item->enddate, 'Y-m-d H:i', $eventTimeZone);
            $perioddates = iCDatePeriod::listDates($item->startdate, $item->enddate, $eventTimeZone);
            $onlyStDate = isset($this->onlyStDate) ? $this->onlyStDate : '';
            // Check the period if individual dates
            $only_startdate = $item->weekdays || $item->weekdays == '0' ? false : true;
            //			if (isset($perioddates) && $perioddates != NULL)
            //			{
            if ($onlyStDate == 1) {
                if (strtotime($StDate) >= strtotime($current_date_start) && strtotime($StDate) < strtotime($current_date_end)) {
                    array_push($AllDates, date('Y-m-d H:i', strtotime($item->startdate)));
                }
            } else {
                foreach ($perioddates as $Dat) {
                    $this_date = JHtml::date($Dat, 'Y-m-d', null);
                    if (in_array(date('w', strtotime($Dat)), $WeeksDays)) {
                        $SingleDate = date('Y-m-d H:i', strtotime($Dat));
                        if (strtotime($this_date) >= strtotime($current_date_start) && strtotime($this_date) < strtotime($current_date_end)) {
                            array_push($AllDates, $SingleDate);
                        }
                    }
                }
            }
            //			}
            rsort($AllDates);
            // requête Itemid
            $iCmenuitem = $params->get('iCmenuitem', '');
            if (is_numeric($iCmenuitem)) {
                $linkid = $iCmenuitem;
            } else {
                $linkid = icagendaMenus::thisEventItemid($item->next, $item->catid, $iC_list_menus);
            }
            $eventnumber = $item->id ? $item->id : null;
            $event_slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
            $total_items = $total_items + 1;
            if ($linkid && !$nolink && JComponentHelper::getComponent('com_icagenda', true)->enabled) {
                $displayed_items = $displayed_items + 1;
                $urlevent = JRoute::_('index.php?option=com_icagenda&amp;view=list&amp;layout=event&amp;id=' . $event_slug . '&amp;Itemid=' . (int) $linkid);
            } else {
                $urlevent = '#';
            }
            $descShort = icagendaEvents::shortDescription($item->desc, true, $this->filtering_shortDesc, $this->limit);
            /**
             * Get Thumbnail
             */
            // START iCthumb
            // Set if run iCthumb
            if ($item->image && $thumb_generator == 1) {
                // Generate small thumb if not exist
                $thumb_img = icagendaThumb::sizeSmall($item->image);
            } elseif ($item->image && $thumb_generator == 0) {
                $thumb_img = $item->image;
            } else {
                $thumb_img = $item->image ? 'media/com_icagenda/images/nophoto.jpg' : '';
            }
            // END iCthumb
            $evtParams = '';
            $evtParams = new JRegistry($item->params);
            // Display Time
            $r_time = $params->get('dp_time', 1) ? true : false;
            // Display City
            $r_city = $params->get('dp_city', 1) ? $item->city : false;
            // Display Country
            $r_country = $params->get('dp_country', 1) ? $item->country : false;
            // Display Venue Name
            $r_place = $params->get('dp_venuename', 1) ? $item->place_name : false;
            // Display Intro Text
            $dp_shortDesc = $params->get('dp_shortDesc', '');
            // Short Description
            if ($dp_shortDesc == '1') {
                $descShort = $item->shortdesc ? $item->shortdesc : false;
            } elseif ($dp_shortDesc == '2') {
                $descShort = $descShort ? $descShort : false;
            } elseif ($dp_shortDesc == '0') {
                $descShort = false;
            } else {
                $e_shortdesc = $item->shortdesc ? $item->shortdesc : $descShort;
                $descShort = $e_shortdesc ? $e_shortdesc : $item->metadesc;
            }
            // Display Registration Infos
            $dp_regInfos = $params->get('dp_regInfos', 1);
            $maxTickets = $dp_regInfos == 1 ? $evtParams->get('maxReg', '1000000') : false;
            $typeReg = $dp_regInfos == 1 ? $evtParams->get('typeReg', '1') : false;
            $event = array('id' => (int) $item->id, 'Itemid' => (int) $linkid, 'title' => $item->title, 'next' => $this->formatDate($item->next), 'image' => $thumb_img, 'file' => $item->file, 'address' => $item->address, 'city' => $r_city, 'country' => $r_country, 'place' => $r_place, 'description' => $item->desc, 'descShort' => $descShort, 'cat_title' => $item->cat_title, 'cat_order' => $item->cat_order, 'cat_color' => $item->cat_color, 'nb_events' => count($item->id), 'no_image' => JTEXT::_('MOD_ICCALENDAR_NO_IMAGE'), 'params' => $item->params, 'features_icon_size' => $this->features_icon_size, 'features_icon_root' => $this->features_icon_root, 'show_icon_title' => $this->show_icon_title, 'features' => $features, 'item' => $item);
            // Access Control
            $access = $item->access ? $item->access : '1';
            // Language Control
            $languages = array(JFactory::getLanguage()->getTag(), '*');
            $eventLang = isset($item->language) ? $item->language : '*';
            // Get Option Dislay Time
            $displaytime = isset($item->displaytime) ? $item->displaytime : '';
            $events_per_day = array();
            // Get List of Dates
            if ((in_array($access, $userLevels) || in_array('8', $userGroups)) && in_array($eventLang, $languages) && is_array($event) && $linkid) {
                $past_dates = 0;
                foreach ($AllDates as $d) {
                    // Control if date is past
                    if (strtotime($d) < strtotime($datetime_today)) {
                        $past_dates = $past_dates + 1;
                    }
                }
                foreach ($AllDates as $d) {
                    $this_date_control = date('Y-m-d H:i', strtotime($d));
                    if ($only_startdate && in_array($this_date_control, $perioddates)) {
                        $set_date_in_url = '';
                    } else {
                        $set_date_in_url = $date_var . iCDate::dateToAlias($d, 'Y-m-d H:i');
                    }
                    if ($r_time) {
                        $time = array('time' => date($lang_time, strtotime($d)), 'displaytime' => $displaytime, 'url' => $urlevent . $set_date_in_url);
                    } else {
                        $time = array('time' => '', 'displaytime' => '', 'url' => $urlevent . $set_date_in_url);
                    }
                    $event = array_merge($event, $time);
                    $this_date = $item->reg_date ? date('Y-m-d H:i:s', strtotime($d)) : 'period';
                    $registrations = $dp_regInfos == 1 ? true : false;
                    $registered = $dp_regInfos == 1 ? self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url) : false;
                    $maxTickets = $maxTickets != '1000000' ? $maxTickets : false;
                    $TicketsLeft = $dp_regInfos == 1 && $maxTickets ? $maxTickets - self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url) : false;
                    // If period started, and registration is set to "for all dates of the event"
                    if ($maxTickets && $past_dates && $typeReg == 2) {
                        $date_sold_out = JText::_('MOD_ICCALENDAR_REGISTRATION_CLOSED');
                    } elseif ($maxTickets) {
                        $date_sold_out = $TicketsLeft <= 0 ? JText::_('MOD_ICCALENDAR_REGISTRATION_DATE_NO_TICKETS_LEFT') : false;
                    } else {
                        $date_sold_out = false;
                    }
                    $reg_infos = array('registrations' => $registrations, 'registered' => $registered, 'maxTickets' => $maxTickets, 'TicketsLeft' => $TicketsLeft, 'date_sold_out' => $date_sold_out);
                    $event = array_merge($event, $reg_infos);
                    foreach ($days as $k => $dy) {
                        //						$d_date		= JHtml::date($d, 'Y-m-d', $eventTimeZone);
                        $d_date = date('Y-m-d', strtotime($d));
                        $dy_date = date('Y-m-d', strtotime($dy['date']));
                        if ($d_date == $dy_date) {
                            array_push($days[$k]['events'], $event);
                        }
                    }
                }
            }
        }
        $i = '';
        if ($nolink || !JComponentHelper::getComponent('com_icagenda', true)->enabled) {
            do {
                echo '<div style="color:#a40505; text-align: center;"><b>info :</b></div><div style="color:#a40505; font-size: 0.8em; text-align: center;">' . JText::_('MOD_ICCALENDAR_COM_ICAGENDA_MENULINK_UNPUBLISHED_MESSAGE') . '</div>';
            } while ($i > 0);
        }
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select('id AS nbevt')->from('`#__icagenda_events` AS e')->where('e.state > 0');
        $db->setQuery($query);
        $nbevt = $db->loadResult();
        $nbevt = count($nbevt);
        $no_event_message = '<div class="ic-msg-no-event">' . JText::_('MOD_ICCALENDAR_NO_EVENT') . '</div>';
        if ($nbevt == NULL) {
            echo $no_event_message;
        }
        // To be Checked
        $total_items = count($result);
        if ($displayed_items == '0' && $total_items > 0) {
            echo $no_event_message;
        }
        if ($total_items > $displayed_items) {
            $not_displayed = $total_items - $displayed_items;
            $user = JFactory::getUser();
            if ($user->authorise('core.admin')) {
                echo '<div class="alert alert-warning">' . JText::sprintf('IC_MODULE_ALERT_EVENTS_NOT_DISPLAYED', $not_displayed) . '</div>';
            }
        }
        return $days;
    }
Exemple #3
0
 protected function notificationManagerEmail($data, $site_menu_title, $user_id)
 {
     $event_id = $data->id;
     $event_title = $data->title;
     $event_site_itemid = $data->site_itemid;
     $event_username = $data->username;
     $event_user_email = $data->created_by_email;
     $event_ref = JHtml::date('now', 'Ymd') . $data->id;
     // Load iCagenda Global Options
     $iCparams = JComponentHelper::getParams('com_icagenda');
     // Load Joomla Application
     $app = JFactory::getApplication();
     // Load Joomla Config Mail Options
     $sitename = $app->getCfg('sitename');
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $app->getCfg('fromname');
     $siteURL = JURI::base();
     $siteURL = rtrim($siteURL, '/');
     // Itemid Request (automatic detection of the first iCagenda menu-link, by menuID, and depending of current language)
     $menu_items = icagendaMenus::iClistMenuItems();
     $itemid_array = array();
     foreach ($menu_items as $l) {
         array_push($itemid_array, $l->id);
     }
     sort($itemid_array);
     $itemID = $itemid_array[0];
     // Set Notification Email to each User groups allowed to approve event submitted
     $groupid = $iCparams->get('approvalGroups', array("8"));
     // Load Global Option for Autologin
     $autologin = $iCparams->get('auto_login', 1);
     jimport('joomla.access.access');
     $adminUsersArray = array();
     foreach ($groupid as $gp) {
         $adminUsers = JAccess::getUsersByGroup($gp, False);
         $adminUsersArray = array_merge($adminUsersArray, $adminUsers);
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     if ($user_id == NULL) {
         $user_id = 0;
     }
     if (!in_array($user_id, $adminUsersArray)) {
         $matches = implode(',', $adminUsersArray);
         $query->select('ui.username AS username, ui.email AS email, ui.password AS passw, ui.block AS block, ui.activation AS activation')->from('#__users AS ui')->where("ui.id IN ({$matches}) ");
     } else {
         $matches = $user_id;
         $query->select('ui.username AS username, ui.email AS email, ui.password AS passw, ui.block AS block, ui.activation AS activation')->from('#__users AS ui')->where("ui.id = {$matches} ");
     }
     $db->setQuery($query);
     $managers = $db->loadObjectList();
     foreach ($managers as $manager) {
         // Mail Replacements
         $replacements = array("\\n" => "\n", '[SITENAME]' => $sitename, '[USERNAME]' => $event_username, '[EMAIL]' => $event_user_email, '[EVENT_TITLE]' => $event_title, '[EVENT_REF]' => $event_ref, '&nbsp;' => ' ');
         if (!in_array($user_id, $adminUsersArray)) {
             $type = 'approval';
         } else {
             $type = 'confirmation';
         }
         // Create Admin Mailer
         $adminmailer = JFactory::getMailer();
         // Set Sender of Notification Email
         $adminmailer->setSender(array($mailfrom, $fromname));
         $username = $manager->username;
         $passw = $manager->passw;
         $email = $manager->email;
         // Set Recipient of Notification Email
         $adminrecipient = $email;
         $adminmailer->addRecipient($adminrecipient);
         // Set Subject of Admin Notification Email
         if (!in_array($user_id, $adminUsersArray)) {
             $adminsubject = JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_SUBJECT', $event_username, $sitename);
         } else {
             $adminsubject = JText::sprintf('COM_ICAGENDA_LEGEND_NEW_EVENT') . ': ' . $event_title;
         }
         // Set Url to preview and checking of event submitted
         $baseURL = JURI::base();
         $subpathURL = JURI::base(true);
         $baseURL = str_replace('/administrator', '', $baseURL);
         $subpathURL = str_replace('/administrator', '', $subpathURL);
         if ($autologin == 1) {
             $urlpreview = str_replace('&amp;', '&', JRoute::_('index.php?option=com_icagenda&view=list&layout=event&id=' . (int) $event_id . '&Itemid=' . (int) $itemID . '&icu=' . $username . '&icp=' . $passw));
             //				$urlcheck = str_replace('&amp;', '&', JRoute::_('administrator/index.php?option=com_icagenda&view=events&Itemid='.(int)$itemID).'&icu='.$username.'&icp='.$passw.'&filter_search='.$event_id);
         } else {
             $urlpreview = str_replace('&amp;', '&', JRoute::_('index.php?option=com_icagenda&view=list&layout=event&id=' . (int) $event_id . '&Itemid=' . (int) $itemID));
             //				$urlcheck = str_replace('&amp;', '&', JRoute::_('administrator/index.php?option=com_icagenda&view=events&Itemid='.(int)$itemID).'&filter_search='.$event_id);
         }
         //			$urlpreview = str_replace('&amp;', '&', $siteURL.'/index.php?option=com_icagenda&view=list&layout=event&id='.(int)$event_id.'&Itemid='.(int)$itemID.'&icu='.$username.'&icp='.$passw);
         $urlpreviewshort = str_replace('&amp;', '&', JRoute::_('index.php?option=com_icagenda&view=list&layout=event&id=' . (int) $event_id . '&Itemid=' . (int) $itemID));
         //			$urlcheckshort = str_replace('&amp;', '&', $siteURL . '/administrator/index.php?option=com_icagenda&view=events');
         // Sub Path filtering
         $subpathURL = ltrim($subpathURL, '/');
         // URL Event Preview filtering
         $urlpreview = ltrim($urlpreview, '/');
         $urlpreviewshort = ltrim($urlpreviewshort, '/');
         if (substr($urlpreview, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
             $urlpreview = substr($urlpreview, strlen($subpathURL) + 1);
         }
         if (substr($urlpreviewshort, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
             $urlpreviewshort = substr($urlpreviewshort, strlen($subpathURL) + 1);
         }
         $urlpreview = rtrim($baseURL, '/') . '/' . ltrim($urlpreview, '/');
         $urlpreviewshort = rtrim($baseURL, '/') . '/' . ltrim($urlpreviewshort, '/');
         // URL Event Check filtering
         //			$urlcheck = ltrim($urlcheck, '/');
         //			if (substr($urlcheck, 0, strlen($subpathURL)+1) == "$subpathURL/")
         //			{
         //				$urlcheck = substr($urlcheck, strlen($subpathURL)+1);
         //			}
         //			$urlcheck = rtrim($baseURL, '/') . '/' . ltrim($urlcheck, '/');
         // Set Body of User Notification Email
         $adminbodycontent = JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_HELLO', $username) . ',<br /><br />';
         if ($type == 'approval') {
             $adminbodycontent .= JText::_('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_NEW_EVENT') . '<br /><br />';
             $adminbodycontent .= JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_APPROVE_INFO', $sitename) . '<br /><br />';
             $adminbodycontent .= JText::_('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_APPROVE_LINK') . ': <a href="' . $urlpreview . '">' . $urlpreviewshort . '</a><br /><br />';
         }
         if ($type == 'confirmation') {
             $adminbodycontent .= JText::_('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_APPROVED_REVIEW') . '<br /><br />';
             $adminbodycontent .= '<a href="' . $urlpreview . '">' . $urlpreviewshort . '</a><br /><br />';
         }
         $user_email_mailto = '<a href="mailto:' . $event_user_email . '">' . $event_user_email . '</a>';
         $adminbodycontent .= JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_SITE_MENUID', $event_site_itemid, $site_menu_title) . '<br />';
         $adminbodycontent .= JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_USER_INFO', $event_username, $user_email_mailto) . '<br /><br />';
         if ($autologin == 1) {
             $adminbodycontent .= '<hr><small>' . JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_FOOTER', $sitename) . '<small>';
         } else {
             $adminbodycontent .= '<hr><small>' . JText::sprintf('COM_ICAGENDA_SUBMISSION_ADMIN_EMAIL_FOOTER_NO_AUTOLOGIN', $sitename) . '<small>';
         }
         $adminbody = rtrim($adminbodycontent);
         // Apply Replacements
         foreach ($replacements as $key => $value) {
             $adminsubject = str_replace($key, $value, $adminsubject);
             $adminbody = str_replace($key, $value, $adminbody);
         }
         $adminmailer->isHTML(true);
         $adminmailer->Encoding = 'base64';
         // Set Subject
         $adminmailer->setSubject($adminsubject);
         // Set Body
         $adminmailer->setBody($adminbody);
         // Send User Notification Email
         if (isset($email)) {
             if ($manager->block == '0' && empty($manager->activation)) {
                 $send = $adminmailer->Send();
             }
         }
     }
 }