Exemplo n.º 1
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $userLevels = implode(',', $user->authorisedLevels());
     $db =& JFactory::getDBO();
     //$menu 		= &JSite::getMenu();
     $menu = JFactory::getApplication()->getMenu();
     $document =& JFactory::getDocument();
     $params = $app->getParams();
     // Specific category
     $id = JRequest::getVar('id', 0, '', 'int');
     // Params
     $categories = $params->get('feed_cat_ids', '');
     $ordering = $params->get('feed_img_ordering', 6);
     $imgCount = $params->get('feed_img_count', 5);
     $feedTitle = $params->get('feed_title', JText::_('COM_PHOCAGALLERY_GALLERY'));
     $tmpl['picasa_correct_width_m'] = (int) $params->get('medium_image_width', 100);
     $tmpl['picasa_correct_height_m'] = (int) $params->get('medium_image_height', 100);
     $document->setTitle($this->escape(html_entity_decode($feedTitle)));
     if ($id > 0) {
         $wheres[] = ' c.id =' . (int) $id;
     } else {
         if (count($categories) > 1) {
             JArrayHelper::toInteger($categories);
             $categoriesString = implode(',', $categories);
             $wheres[] = ' c.id IN ( ' . $categoriesString . ' ) ';
         } else {
             if ((int) $categories > 0) {
                 $wheres[] = ' c.id IN ( ' . $categories . ' ) ';
             }
         }
     }
     $imageOrdering = PhocaGalleryOrdering::getOrderingString($ordering, 6);
     $wheres[] = ' a.published = 1';
     $wheres[] = ' a.approved = 1';
     $wheres[] = ' c.published = 1';
     $wheres[] = ' c.approved = 1';
     $wheres[] = ' c.access IN (' . $userLevels . ')';
     $u = " (c.accessuserid LIKE '%0%' OR c.accessuserid LIKE '%-1%' OR c.accessuserid LIKE '%," . (int) $user->id . "' OR c.accessuserid LIKE '" . (int) $user->id . ",%' OR c.accessuserid LIKE '%," . (int) $user->id . ",%' OR c.accessuserid =" . (int) $user->id . ") ";
     $e = 'c.accessuserid IS NULL';
     $wheres[] = ' CASE WHEN c.accessuserid IS NOT NULL THEN ' . $u . ' ELSE ' . $e . ' END';
     $query = 'SELECT a.*, c.alias as catalias, c.title as categorytitle' . ' FROM #__phocagallery AS a' . ' LEFT JOIN #__phocagallery_categories AS c ON a.catid = c.id' . ' WHERE ' . implode(' AND ', $wheres) . $imageOrdering['output'];
     $db->setQuery($query, 0, $imgCount);
     $images = $db->loadObjectList();
     foreach ($images as $keyI => $value) {
         $item = new JFeedItem();
         $title = $this->escape($value->title);
         $title = html_entity_decode($title);
         $item->title = $title;
         $link = PhocaGalleryRoute::getCategoryRoute($value->catid, $value->catalias);
         $item->link = JRoute::_($link);
         // imgDate
         $imgDate = '';
         $imgDate = JHtml::Date($value->date, "Y-m-d h:m:s");
         if ($imgDate != '') {
             $item->date = $imgDate;
         }
         $item->description = '';
         if ($value->description != '') {
             $item->description .= '<div>' . $value->description . '</div>';
         }
         $extImage = false;
         if (isset($value->extid)) {
             $extImage = PhocaGalleryImage::isExtImage($value->extid);
         }
         // Trying to fix but in Joomla! method $this->_relToAbs - it cannot work with JRoute links :-(
         $itemL = str_replace(JURI::base(true), '', $item->link);
         if (substr($itemL, 0, 1) == '/') {
             $itemL = substr_replace($itemL, '', 0, 1);
         }
         $itemL = JURI::base() . $itemL;
         // Should really not happen
         $itemLTmp = str_replace('http://', '', $itemL);
         $pos = stripos($itemLTmp, '//');
         if ($pos !== false) {
             $itemLTmp = str_replace('//', '/', $itemLTmp);
             $itemL = 'http://' . $itemLTmp;
         }
         // - - - - - - - - - - -
         if ($extImage) {
             $correctImageRes = PhocaGalleryPicasa::correctSizeWithRate($value->extw, $value->exth, $tmpl['picasa_correct_width_m'], $tmpl['picasa_correct_height_m']);
             $imgLink = $value->extm;
             //$i = '<div><a href="'.JRoute::_($link).'"><img src="'.$imgLink .'" border="0" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" /></a></div>';
             $i = '<div><a href="' . $itemL . '"><img src="' . $imgLink . '" border="0" /></a></div>';
         } else {
             $imgLink = PhocaGalleryImageFront::displayCategoryImageOrNoImage($value->filename, 'medium');
             $i = '<div><a href="' . $itemL . '"><img src="' . $imgLink . '" border="0" /></a></div>';
         }
         $item->description .= $i;
         $item->category = $value->categorytitle;
         /*if ($value->author != '') {
         			$item->author		= $value->author;
         		}*/
         $document->addItem($item);
     }
 }
Exemplo n.º 2
0
            ?>
									<?php 
            echo JHtml::date($item->datum, JText::_('DATE_FORMAT_LC4'));
            ?>
								<?php 
        }
        ?>
							</td>
							<td class="nowrap">
								<?php 
        echo $item->tauchplatz;
        ?>
							</td>
							<td class="hidden-phone">
								<?php 
        echo JHtml::Date($item->meldedatum, JText::_('DATE_FORMAT_LC2'));
        ?>
							</td>
							<td class="nowrap hidden-phone">
								<?php 
        echo (int) $item->id;
        ?>
							</td>
						</tr>
					<?php 
    }
    ?>
					</tbody>
				</table>
			<?php 
}
Exemplo n.º 3
0
</a>
						</div>
					</div>
				</div><?php 
            // subfolder
            if ($value->type == 1) {
                if ($value->display_name == 1 || $value->display_name == 2) {
                    echo '<div class="pg-name">' . PhocaGalleryText::wordDelete($value->title, $this->tmpl['charlengthname'], '...') . '</div>';
                }
            }
            // image
            if ($value->type == 2) {
                if ($value->display_name == 1) {
                    echo '<div class="pg-name">' . PhocaGalleryText::wordDelete($value->title, $this->tmpl['charlengthname'], '...') . '</div>';
                }
                if ($value->display_name == 2) {
                    echo '<div class="pg-name">&nbsp;</div>';
                }
            }
            echo '<div class="detail" style="margin-top:2px;text-align:left">';
            echo JHtml::_('image', 'media/com_phocagallery/images/icon-date.png', JText::_('COM_PHOCAGALLERY_IMAGE_DETAIL'));
            echo '&nbsp;&nbsp; ' . JHtml::Date($value->date, "d. m. Y");
            echo '</div>';
            echo '<div class="ph-cb"></div>';
            echo '</div>';
        }
        echo '<div class="ph-cb"></div>';
    }
}
// END MOST VIEWED
echo '</div>' . "\n";
Exemplo n.º 4
0
	/**
	 * This method handles any mailings triggered by an venue store action
	 *
	 * @access  public
	 * @param   int 	$venue_id 	 Integer Venue identifier
	 * @param   int 	$is_new  	 Integer Venue new or edited
	 * @return  boolean
	 *
	 */
	public function onVenueEdited($venue_id, $is_new)
	{
		// Sendto
		$send_to = array(
			'user' => $is_new ? $this->params->get('newvenue_mail_user', '1') : $this->params->get('editvenue_mail_user', '0'),
			'admin' => $is_new ? $this->params->get('newvenue_mail_admin', '1') : $this->params->get('editvenue_mail_admin', '0'),
		);

		// Skip if processing not needed
		if (!array_filter($send_to)) return true;


		$user 	= JFactory::getUser();
		$username = empty($this->_UseLoginName) ? $user->name : $user->username;

		// get data
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$case_when = ' CASE WHEN ';
		$case_when .= $query->charLength('alias');
		$case_when .= ' THEN ';
		$id = $query->castAsChar('id');
		$case_when .= $query->concatenate(array($id, 'alias'), ':');
		$case_when .= ' ELSE ';
		$case_when .= $id.' END as slug';

		$query->select(array('id','published','venue','city','street','postalCode','url','country','locdescription','created','modified',$case_when));
		$query->from('#__jem_venues');
		$query->where(array('id= '.$db->quote($venue_id)));

		$db->setQuery($query);
		if (is_null($venue = $db->loadObject())) return false;

		# at this point we do have a result

		// Define link for venue
		$link = JRoute::_(JUri::base().JEMHelperRoute::getVenueRoute($venue->slug), false);

		// Define published-state message
		$adminstate = $venue->published ? JText::sprintf('PLG_JEM_MAILER_VENUE_PUBLISHED', $link) : JText::_('PLG_JEM_MAILER_VENUE_UNPUBLISHED');
		$userstate = $venue->published ? JText::sprintf('PLG_JEM_MAILER_USER_MAIL_VENUE_PUBLISHED', $link) : JText::_('PLG_JEM_MAILER_USER_MAIL_VENUE_UNPUBLISHED');

		// Strip tags/scripts,etc from description
		$text_description = JFilterOutput::cleanText($venue->locdescription);


		#######################
		## RECEIVERS - ADMIN ##
		#######################

		# in here we selected the option to send to admin.
		# we selected admin so we can use the adminDBList.
		# if the adminDBList is empty mailing should stop!

		if ($send_to['admin']) {

			$admin_receivers = $this->_AdminDBList;

			if ($admin_receivers) {
				$data = new stdClass();

				# is the venue new or edited?
				if ($is_new) {
					# the venue is new and we send a mail to adminDBList
					$created = JHtml::Date($venue->created, JText::_('DATE_FORMAT_LC2'));
					$data->subject = JText::sprintf('PLG_JEM_MAILER_NEW_VENUE_MAIL', $this->_SiteName, $venue->venue);
					$data->body = JText::sprintf('PLG_JEM_MAILER_NEW_VENUE_A', $username, $created, $venue->venue, $venue->url, $venue->street, $venue->postalCode, $venue->city, $venue->country, $text_description, $adminstate);
				} else {
					# the venue is edited and we send a mail to adminDBList
					$modified = JHtml::Date($venue->modified, JText::_('DATE_FORMAT_LC2'));
					$data->subject = JText::sprintf('PLG_JEM_MAILER_EDIT_VENUE_MAIL', $this->_SiteName, $venue->venue);
					$data->body = JText::sprintf('PLG_JEM_MAILER_EDIT_VENUE_A', $username, $modified, $venue->venue, $venue->url, $venue->street, $venue->postalCode, $venue->city, $venue->country, $text_description, $adminstate);
				}
				$data->receivers = $admin_receivers;

				$this->_mailer($data);
			} else {
				return false;
			}
		}

		######################
		## RECEIVERS - USER ##
		######################

		# here we selected the option to send to a logged in user
		# we make a selection between added/edited venue
		# -> here we don't specify an extra variable

		if ($send_to['user']) {
			$data = new stdClass();

			if ($is_new) {
				$created = JHtml::Date($venue->created, JText::_('DATE_FORMAT_LC2'));
				$data->subject = JText::sprintf('PLG_JEM_MAILER_NEW_USER_VENUE_MAIL', $this->_SiteName, $venue->venue);
				$data->body = JText::sprintf('PLG_JEM_MAILER_USER_MAIL_NEW_VENUE_A', $username, $created, $venue->venue, $venue->url, $venue->street, $venue->postalCode, $venue->city, $venue->country, $text_description, $userstate);
			} else {
				$modified = JHtml::Date($venue->modified, JText::_('DATE_FORMAT_LC2'));
				$data->subject = JText::sprintf('PLG_JEM_MAILER_EDIT_USER_VENUE_MAIL', $this->_SiteName, $venue->venue);
				$data->body = JText::sprintf('PLG_JEM_MAILER_USER_MAIL_EDIT_VENUE_A', $username, $modified, $venue->venue, $venue->url, $venue->street, $venue->postalCode, $venue->city, $venue->country, $text_description, $userstate);
			}

			$data->receivers = $user->email;
			$this->_mailer($data);
		}

		return true;
	}
Exemplo n.º 5
0
 public function getData()
 {
     $app = JFactory::getApplication();
     $eventTimeZone = null;
     $error_messages = array();
     jimport('joomla.filter.output');
     // Get Params
     $params = $app->getParams();
     $submitAccess = $params->get('submitAccess', '');
     $approvalGroups = $params->get('approvalGroups', array("8"));
     // Get User
     $user = JFactory::getUser();
     // Get User Groups
     // Joomla 3.x/2.5 SWITCH
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $userGroups = $user->groups;
     } else {
         $userGroups = $user->getAuthorisedGroups();
     }
     $user_id = $user->get('id');
     // logged-in Users: Name/User Name Option
     $nameJoomlaUser = $params->get('nameJoomlaUser', 1);
     $u_name = $nameJoomlaUser == 1 ? $user->get('name') : $user->get('username');
     $this->data = new stdClass();
     $this->data->id = null;
     $this->data->asset_id = JRequest::getVar('asset_id', '', 'post');
     $this->data->ordering = 0;
     $this->data->state = 1;
     // Control: if Manager
     jimport('joomla.access.access');
     $adminUsersArray = array();
     foreach ($approvalGroups as $ag) {
         $adminUsers = JAccess::getUsersByGroup($ag, False);
         $adminUsersArray = array_merge($adminUsersArray, $adminUsers);
     }
     $this->data->approval = in_array($user_id, $adminUsersArray) ? '0' : '1';
     $this->data->access = 1;
     $this->data->language = '*';
     //		$menuID 						= JRequest::getVar('menuID', '', 'post');
     // USER NAME
     $this->data->username = JRequest::getVar('username', '', 'post');
     if (!$this->data->username) {
         $error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_SUBMIT_FORM_USER_NAME'));
     }
     // USER EMAIL
     $this->data->created_by_email = JRequest::getVar('created_by_email', '', 'post');
     if (!$this->data->created_by_email) {
         $error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_SUBMIT_FORM_USER_EMAIL'));
     }
     // EVENT TITLE
     $this->data->title = JRequest::getVar('title', '', 'post');
     if (!$this->data->title) {
         $error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_FORM_LBL_EVENT_TITLE'));
     }
     // EVENT CATEGORY
     $this->data->catid = JRequest::getVar('catid', '', 'post');
     if (!$this->data->catid) {
         $error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_FORM_LBL_EVENT_CATID'));
     }
     // EVENT IMAGE - Get and Upload Image
     $image = JRequest::getVar('image', null, 'files', 'array');
     $image_session = JRequest::getVar('image_session', '', 'post');
     if ($image_session && empty($image)) {
         $this->data->image = $image_session;
     } else {
         $this->data->image = $image;
         // Process upload of files
         $this->data->image = $this->frontendImageUpload($this->data->image);
     }
     $noDateTime = '0000-00-00 00:00:00';
     $noDateTimeShort = '0000-00-00 00:00';
     // Get Single Dates
     $single_dates = JRequest::getVar('dates', '', 'post');
     $dates = iCString::isSerialized($single_dates) ? unserialize($single_dates) : $this->getDates($single_dates);
     //		$dates = !empty($dates[0]) ? $dates : array($noDateTime);
     rsort($dates);
     $datesall = iCDate::isDate($dates[0]) ? $dates[0] : $noDateTimeShort;
     if ($datesall != $noDateTimeShort) {
         $this->data->dates = serialize($dates);
     } else {
         $no_date_array = array($noDateTimeShort);
         $this->data->dates = serialize($no_date_array);
     }
     // Set Next Date from Single Dates
     $dates_array = unserialize($this->data->dates);
     $today = JHtml::date('now', 'Y-m-d H:i:s', $eventTimeZone);
     $next = JHtml::date($this->data->dates[0], 'Y-m-d H:i:s', $eventTimeZone);
     rsort($dates_array);
     $nextDate = $next;
     if ($next <= $today) {
         foreach ($dates_array as $date) {
             $single_date = JHtml::date($date, 'Y-m-d H:i:s', $eventTimeZone);
             if ($single_date >= $today) {
                 $nextDate = $single_date;
             }
         }
     }
     $single_dates_next = $nextDate;
     // PERIOD DATES
     $this->data->startdate = JRequest::getVar('startdate', '', 'post');
     $this->data->enddate = JRequest::getVar('enddate', '', 'post');
     $isDate_startdate = iCDate::isDate($this->data->startdate);
     $isDate_enddate = iCDate::isDate($this->data->enddate);
     $this->data->startdate = $isDate_startdate ? $this->data->startdate : $noDateTime;
     $this->data->enddate = $isDate_enddate ? $this->data->enddate : $noDateTime;
     // Dates from the period
     if ($isDate_startdate && $isDate_enddate) {
         $startdate = $this->data->startdate;
         $enddate = $this->data->enddate;
         if ($startdate == $noDateTime && $enddate != $noDateTime) {
             $enddate = $noDateTime;
         }
         $startcontrol = JHtml::date($startdate, 'Y-m-d H:i', $eventTimeZone);
         $endcontrol = JHtml::date($enddate, 'Y-m-d H:i', $eventTimeZone);
         $errorperiod = '';
         if ($startcontrol > $endcontrol) {
             $errorperiod = '1';
         } else {
             $period_all_dates_array = iCDatePeriod::listDates($startdate, $enddate);
         }
         // Serialize Dates of the Period
         if ($isDate_startdate && $isDate_enddate) {
             if ($errorperiod != '1') {
                 $this->data->period = serialize($period_all_dates_array);
                 $ctrl = unserialize($this->data->period);
                 if (is_array($ctrl)) {
                     $period = unserialize($this->data->period);
                 } else {
                     $period = $this->getPeriod($this->data->period);
                 }
                 rsort($period);
                 $this->data->period = serialize($period);
             } else {
                 $this->data->period = '';
             }
         }
         $period_dates_next = $this->data->startdate;
         $dates_next = JHtml::date($single_dates_next, 'Y-m-d H:i:s', $eventTimeZone);
         $period_next = JHtml::date($period_dates_next, 'Y-m-d H:i:s', $eventTimeZone);
         if ($dates_next < $period_next) {
             $this->data->next = $period_next;
         } else {
             $this->data->next = $dates_next;
         }
     } else {
         $this->data->period = '';
         $this->data->next = $single_dates_next;
     }
     // Period and Single Dates not displayed
     if ((in_array($noDateTime, $dates_array) || in_array($noDateTimeShort, $dates_array)) && (!$isDate_startdate || !$isDate_enddate)) {
         $this->data->state = '0';
         $this->data->next = $today;
         // Error message if no valid dates
         $error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_WARNING', JText::_('COM_ICAGENDA_FORM_ERROR_NO_DATES'));
     }
     // WEEK DAYS
     $this->data->weekdays = JRequest::getVar('weekdays', '', 'post');
     if (!isset($this->data->weekdays) && !is_array($this->data->weekdays)) {
         $this->data->weekdays = '';
     }
     if (isset($this->data->weekdays) && is_array($this->data->weekdays)) {
         $this->data->weekdays = implode(",", $this->data->weekdays);
     }
     // Joomla 3.x/2.5 SWITCH
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $this->data->desc = JFactory::getApplication()->input->get('desc', '', 'RAW');
     } else {
         $this->data->desc = JRequest::getVar('desc', '', 'post', 'string', JREQUEST_ALLOWHTML);
     }
     $this->data->shortdesc = JRequest::getVar('shortdesc', '', 'post');
     $this->data->metadesc = JRequest::getVar('metadesc', '', 'post');
     $this->data->place = JRequest::getVar('place', '', 'post');
     $this->data->email = JRequest::getVar('email', '', 'post');
     $this->data->phone = JRequest::getVar('phone', '', 'post');
     $this->data->website = JRequest::getVar('website', '', 'post');
     // ATTACHMENT FILE
     $file = JRequest::getVar('file', null, 'files', 'array');
     $file_session = JRequest::getVar('file_session', '', 'post');
     if ($file_session && empty($file)) {
         $this->data->file = $file_session;
     } else {
         $this->data->file = $file;
         // Process upload of files
         $this->data->file = $this->frontendFileUpload($this->data->file);
     }
     $this->data->address = JRequest::getVar('address', '', 'post');
     $this->data->city = JRequest::getVar('city', '', 'post');
     $this->data->country = JRequest::getVar('country', '', 'post');
     $this->data->lat = JRequest::getVar('lat', '', 'post');
     $this->data->lng = JRequest::getVar('lng', '', 'post');
     $this->data->created_by = $user_id;
     $this->data->created_by_alias = JRequest::getVar('created_by_alias', '', 'post');
     $this->data->created = JHtml::Date('now', 'Y-m-d H:i:s');
     $this->data->checked_out = JRequest::getVar('checked_out', '', 'post');
     $this->data->checked_out_time = JRequest::getVar('checked_out_time', '', 'post');
     $this->data->params = JRequest::getVar('params', '', 'post');
     $this->data->site_itemid = JRequest::getVar('site_itemid', '0', 'post');
     $site_menu_title = JRequest::getVar('site_menu_title', '', 'post');
     // Generate Alias
     $this->data->alias = JFilterOutput::stringURLSafe($this->data->title);
     // Alias is not generated if non-latin characters, so we fix it by using created date, or title if unicode is activated, as alias
     if ($this->data->alias == null) {
         if (JFactory::getConfig()->get('unicodeslugs') == 1) {
             $this->data->alias = JFilterOutput::stringURLUnicodeSlug($this->data->title);
         } else {
             $this->data->alias = JFilterOutput::stringURLSafe($this->data->created);
         }
     }
     // Convert the params field to a string.
     if (isset($this->data->params) && is_array($this->data->params)) {
         $parameter = new JRegistry();
         $parameter->loadArray($this->data->params);
         $this->data->params = (string) $parameter;
     }
     $this->data->asset_id = null;
     $custom_fields = JRequest::getVar('custom_fields', '', 'post');
     // Check if Custom Fields required not empty
     $customfields_list = icagendaCustomfields::getListCustomFields($this->data->id, 2, 1);
     if ($customfields_list) {
         foreach ($customfields_list as $cf) {
             if (isset($custom_fields[$cf->cf_slug]) && $cf->cf_required == 1 && $custom_fields[$cf->cf_slug] == '') {
                 $options_required = array('list', 'radio');
                 // If type is list or radio, should have options
                 if (in_array($cf->cf_type, $options_required) && $cf->cf_options || !in_array($cf->cf_type, $options_required)) {
                     $error_messages[] = JText::_('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED') . ' ' . $cf->cf_title;
                 }
             }
         }
     }
     $address_session = JRequest::getVar('address_session', '', 'post');
     $submit_tos = JRequest::getVar('submit_tos', '', 'post');
     // Set Form Data to Session
     $session = JFactory::getSession();
     $session->set('ic_submit', $this->data);
     $session->set('custom_fields', $custom_fields);
     $session->set('ic_submit_dates', $this->data->dates);
     $session->set('ic_submit_catid', $this->data->catid);
     $session->set('ic_submit_shortdesc', $this->data->shortdesc);
     $session->set('ic_submit_metadesc', $this->data->metadesc);
     $session->set('ic_submit_city', $this->data->city);
     $session->set('ic_submit_country', $this->data->country);
     $session->set('ic_submit_lat', $this->data->lat);
     $session->set('ic_submit_lng', $this->data->lng);
     $session->set('ic_submit_address', $this->data->address);
     $session->set('ic_submit_tos', $submit_tos);
     // Captcha Control
     $captcha = JRequest::getVar('recaptcha_response_field', '', 'post');
     $captcha_plugin = $params->get('captcha') ? $params->get('captcha') : $app->getCfg('captcha');
     $submit_captcha = $params->get('submit_captcha', 1);
     if ($captcha_plugin && $submit_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', $captcha);
         if (!$res[0]) {
             // message if captcha is invalid
             $error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_ERROR', JText::_('COM_ICAGENDA_FORM_ERROR_INCORRECT_CAPTCHA_SOL'));
         }
     }
     // Get the message queue
     if (count($error_messages)) {
         $app->enqueueMessage('<strong>' . JText::_('COM_ICAGENDA_FORM_NC') . '</strong>', 'error');
         foreach ($error_messages as $msg) {
             $app->enqueueMessage($msg, 'error');
         }
         return false;
     }
     // clear the data so we don't process it again
     $session->clear('ic_submit');
     $session->clear('custom_fields');
     $session->clear('ic_submit_dates');
     $session->clear('ic_submit_catid');
     $session->clear('ic_submit_shortdesc');
     $session->clear('ic_submit_metadesc');
     $session->clear('ic_submit_city');
     $session->clear('ic_submit_country');
     $session->clear('ic_submit_lat');
     $session->clear('ic_submit_lat');
     $session->clear('ic_submit_address');
     $session->clear('ic_submit_tos');
     // insert Event in Database
     $db = JFactory::getDbo();
     if ($this->data->username != NULL && $this->data->title != NULL && $this->data->created_by_email != NULL) {
         $db->insertObject('#__icagenda_events', $this->data, id);
     } else {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Save Custom Fields to database
     if (isset($custom_fields) && is_array($custom_fields)) {
         icagendaCustomfields::saveToData($custom_fields, $this->data->id, 2);
     }
     // Get the "event" URL
     $baseURL = JURI::base();
     $subpathURL = JURI::base(true);
     $baseURL = str_replace('/administrator', '', $baseURL);
     $subpathURL = str_replace('/administrator', '', $subpathURL);
     $urlsend = str_replace('&amp;', '&', JRoute::_('index.php?option=com_icagenda&view=submit&layout=send'));
     // Sub Path filtering
     $subpathURL = ltrim($subpathURL, '/');
     // URL List filtering
     $urlsend = ltrim($urlsend, '/');
     if (substr($urlsend, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
         $urlsend = substr($urlsend, strlen($subpathURL) + 1);
     }
     $urlsend = rtrim($baseURL, '/') . '/' . ltrim($urlsend, '/');
     if (isset($this->data->id) and $this->data->id != '0' and $this->data->username != NULL and $this->data->title != NULL) {
         self::notificationManagerEmail($this->data, $site_menu_title, $user_id);
         if (!in_array($user_id, $adminUsersArray)) {
             self::notificationUserEmail($this->data, $urlsend);
         }
     } else {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // redirect after successful submission
     $submit_return = $params->get('submitReturn', '');
     $submit_return_article = $params->get('submitReturn_Article', $urlsend);
     $submit_return_url = $params->get('submitReturn_Url', $urlsend);
     if ($submit_return == 1 && is_numeric($submit_return_article)) {
         $url_return = JURI::root() . 'index.php?option=com_content&view=article&id=' . $submit_return_article;
     } elseif ($submit_return == 2) {
         $url_return = $submit_return_url;
     } else {
         $url_return = $urlsend;
     }
     $alert_title = $params->get('alert_title', '');
     $alert_body = $params->get('alert_body', '');
     $url_redirect = $urlsend_custom ? $urlsend_custom : $urlsend;
     $alert_title_redirect = $alert_title ? $alert_title : JText::_('COM_ICAGENDA_EVENT_SUBMISSION');
     $alert_body_redirect = $alert_body ? $alert_body : JText::_('COM_ICAGENDA_EVENT_SUBMISSION_CONFIRMATION');
     if ($submit_return != 2) {
         $app->enqueueMessage($alert_body_redirect, $alert_title_redirect);
         $app->redirect(htmlspecialchars_decode($url_return));
     } else {
         $url_return = iCUrl::urlParsed($url_return, 'scheme');
         $app->redirect($url_return);
     }
 }
Exemplo n.º 6
-1
 /**
  * Method to get the field options.
  *
  * @return  array   The field option objects.
  * @since   1.6
  */
 public function getOptions()
 {
     // Initialize variables.
     $options = array();
     $date = JHtml::Date('', 'Y-m-d H:m:s', true);
     $dateformats = array('DATE_FORMAT_LC', 'DATE_FORMAT_LC1', 'DATE_FORMAT_LC2', 'DATE_FORMAT_LC3', 'DATE_FORMAT_LC4');
     foreach ($dateformats as $key => $format) {
         $options[$key]['value'] = $format;
         $options[$key]['text'] = JHtml::Date($date, JText::_($format), true);
     }
     return $options;
 }