예제 #1
0
 /**
  * Creates the output for venue submissions
  *
  * @since 0.5
  * @param int $tpl
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     if (!$user->id) {
         $app->redirect(JRoute::_($_SERVER["HTTP_REFERER"]), JText::_('Please login to be able to submit venues'), 'error');
     }
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     // Get requests
     $id = JRequest::getInt('id');
     //Get Data from the model
     $row = $this->Get('Venue');
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     $id ? $title = JText::_('EDIT VENUE') : ($title = JText::_('ADD VENUE'));
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Set Title
     $doc->setTitle($title);
     //editor user
     $editoruser = ELUser::editoruser();
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->locdescription = ELHelper::br2break($row->locdescription);
     }
     //Get image
     $limage = ELImage::flyercreator($row->locimage);
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     // country list
     $countries = array();
     $countries[] = JHTML::_('select.option', '', JText::_('Select country'));
     $countries = array_merge($countries, ELHelper::getCountryOptions());
     $lists['countries'] = JHTML::_('select.genericlist', $countries, 'country', 'class="inputbox"', 'value', 'text', $row->country);
     unset($countries);
     $this->assignRef('row', $row);
     $this->assignRef('editor', $editor);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('limage', $limage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     $this->assignRef('lists', $lists);
     $this->assignRef('title', $title);
     $this->assignRef('mode', JRequest::getVar('mode', ''));
     parent::display($tpl);
 }
예제 #2
0
 /**
  * Creates the output for venue submissions
  *
  * @since 0.5
  * @param int $tpl
  */
 function display($tpl = null)
 {
     global $mainframe;
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     // Get requests
     $id = JRequest::getInt('id');
     //Get Data from the model
     $row = $this->Get('Venue');
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_eventlist');
     $id ? $title = JText::_('EDIT VENUE') : ($title = JText::_('ADD VENUE'));
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Set Title
     $doc->setTitle($title);
     //editor user
     $editoruser = ELUser::editoruser();
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->locdescription = ELHelper::br2break($row->locdescription);
     }
     //Get image
     $limage = ELImage::flyercreator($row->locimage);
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     $this->assignRef('row', $row);
     $this->assignRef('editor', $editor);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('limage', $limage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #3
0
 /**
  * logic for uploading an image
  *
  * @access public
  * @return void
  * @since 0.9
  */
 function uploadimage()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $elsettings = ELAdmin::config();
     $file = JRequest::getVar('userfile', '', 'files', 'array');
     $task = JRequest::getVar('task');
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     //$ftp = JClientHelper::getCredentials('ftp');
     //set the target directory
     if ($task == 'venueimgup') {
         $base_Dir = JPATH_SITE . DS . 'images' . DS . 'eventlist' . DS . 'venues' . DS;
     } else {
         $base_Dir = JPATH_SITE . DS . 'images' . DS . 'eventlist' . DS . 'events' . DS;
     }
     //do we have an upload?
     if (empty($file['name'])) {
         echo "<script> alert('" . JText::_('IMAGE EMPTY') . "'); window.history.go(-1); </script>\n";
         $mainframe->close();
     }
     //check the image
     $check = ELImage::check($file, $elsettings);
     if ($check === false) {
         $mainframe->redirect($_SERVER['HTTP_REFERER']);
     }
     //sanitize the image filename
     $filename = ELImage::sanitize($base_Dir, $file['name']);
     $filepath = $base_Dir . $filename;
     //upload the image
     if (!JFile::upload($file['tmp_name'], $filepath)) {
         echo "<script> alert('" . JText::_('UPLOAD FAILED') . "'); window.history.go(-1); </script>\n";
         $mainframe->close();
     } else {
         echo "<script> alert('" . JText::_('UPLOAD COMPLETE') . "'); window.history.go(-1); window.parent.elSelectImage('{$filename}', '{$filename}'); </script>\n";
         $mainframe->close();
     }
 }
예제 #4
0
파일: venues.php 프로젝트: julienV/testrepo
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $app =& JFactory::getApplication();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings =& ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $venue =& $this->_data[$i];
             //Create image information
             $venue->limage = ELImage::flyercreator($venue->locimage);
             //Generate Venuedescription
             if (empty($venue->locdescription)) {
                 $venue->locdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $venue->text = $venue->locdescription;
                 $venue->title = $venue->venue;
                 JPluginHelper::importPlugin('content');
                 $results = $app->triggerEvent('onPrepareContent', array(&$venue, &$params, 0));
                 $venue->locdescription = $venue->text;
             }
             //build the url
             if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
                 $venue->url = 'http://' . $venue->url;
             }
             //prepare the url for output
             if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
                 $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
             } else {
                 $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
             }
             //create flag
             if ($venue->country) {
                 $venue->countryimg = ELOutput::getFlag($venue->country);
             }
             //create target link
             $task = JRequest::getVar('task', '', '', 'string');
             if ($task == 'archive') {
                 $venue->targetlink = JRoute::_('index.php?view=venueevents&id=' . $venue->slug . '&task=archive');
             } else {
                 $venue->targetlink = JRoute::_('index.php?view=venueevents&id=' . $venue->slug);
             }
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
예제 #5
0
 /**
  * Method to store the venue
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $tzoffset = $app->getCfg('offset');
     $row =& JTable::getInstance('eventlist_venues', '');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         //check if user is allowed to edit venues
         $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->created_by, $elsettings->venueeditrec, $elsettings->venueedit);
         if ($allowedtoeditvenue == 0) {
             $row->checkin();
             $app->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
         //Is editor the owner of the venue
         //This extra Check is needed to make it possible
         //that the venue is published after an edit from an owner
         if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new venues
         $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
         if ($delloclink == 0) {
             $app->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //set owneredit to false
         $owneredit = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/venues/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $app->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->locimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->locimage = $row->curimage;
     }
     //end image upload if
     //Check description
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check description --> wipe out code
         $row->locdescription = strip_tags($row->locdescription, '<br><br/>');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription);
         //cut too long words
         $row->locdescription = wordwrap($row->locdescription, 75, " ", 1);
         //check length
         $length = JString::strlen($row->locdescription);
         if ($length > $elsettings->datdesclimit) {
             // if required shorten it
             $row->locdescription = JString::substr($row->locdescription, 0, $elsettings->datdesclimit);
             //if shortened add ...
             $row->locdescription = $row->locdescription . '...';
         }
     }
     //Autopublish
     //check if the user has the required rank for autopublish
     $autopublloc = ELUser::validate_user($elsettings->locpubrec, $elsettings->autopublocate);
     //Check if user is the owner of the venue
     //If yes enable autopublish
     if ($autopublloc || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     $row->version++;
     //Make sure the data is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     //store it in the db
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     //update item order
     $row->reorder();
     return $row->id;
 }
예제 #6
0
 /**
  * Creates image information of an image
  *
  * @author Christoph Lukes
  * @since 0.9
  *
  * @param string $image The image name
  * @param array $settings
  * @param string $type event or venue
  *
  * @return imagedata if available
  */
 function flyercreator($image, $type = 'venue')
 {
     $settings =& ELHelper::config();
     jimport('joomla.filesystem.file');
     //define the environment based on the type
     if ($type == 'event') {
         $folder = 'events';
     } else {
         $folder = 'venues';
     }
     if ($image) {
         //Create thumbnail if enabled and it does not exist already
         if ($settings->gddisabled == 1 && !file_exists(JPATH_SITE . '/images/eventlist/' . $folder . '/small/' . $image)) {
             $filepath = JPATH_SITE . '/images/eventlist/' . $folder . '/' . $image;
             $save = JPATH_SITE . '/images/eventlist/' . $folder . '/small/' . $image;
             ELImage::thumb($filepath, $save, $settings->imagewidth, $settings->imagehight);
         }
         //set paths
         $dimage['original'] = 'images/eventlist/' . $folder . '/' . $image;
         $dimage['thumb'] = 'images/eventlist/' . $folder . '/small/' . $image;
         //get imagesize of the original
         $iminfo = @getimagesize('images/eventlist/' . $folder . '/' . $image);
         //if the width or height is too large this formula will resize them accordingly
         if ($iminfo[0] > $settings->imagewidth || $iminfo[1] > $settings->imagehight) {
             $iRatioW = $settings->imagewidth / $iminfo[0];
             $iRatioH = $settings->imagehight / $iminfo[1];
             if ($iRatioW < $iRatioH) {
                 $dimage['width'] = round($iminfo[0] * $iRatioW);
                 $dimage['height'] = round($iminfo[1] * $iRatioW);
             } else {
                 $dimage['width'] = round($iminfo[0] * $iRatioH);
                 $dimage['height'] = round($iminfo[1] * $iRatioH);
             }
         } else {
             $dimage['width'] = $iminfo[0];
             $dimage['height'] = $iminfo[1];
         }
         if (JFile::exists(JPATH_SITE . '/images/eventlist/' . $folder . '/small/' . $image)) {
             //get imagesize of the thumbnail
             $thumbiminfo = @getimagesize('images/eventlist/' . $folder . '/small/' . $image);
             $dimage['thumbwidth'] = $thumbiminfo[0];
             $dimage['thumbheight'] = $thumbiminfo[1];
         }
         return $dimage;
     }
     return false;
 }
예제 #7
0
 /**
  * Method to store the event
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     global $mainframe;
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     //Get mailinformation
     $SiteName = $mainframe->getCfg('sitename');
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $tzoffset = $mainframe->getCfg('offset');
     $row =& JTable::getInstance('eventlist_events', '');
     //Sanitize
     $data['datdescription'] = JRequest::getVar('datdescription', '', 'post', 'string', JREQUEST_ALLOWRAW);
     //include the metatags
     $data['meta_description'] = addslashes(htmlspecialchars(trim($elsettings->meta_description)));
     if (strlen($data['meta_description']) > 255) {
         $data['meta_description'] = substr($data['meta_description'], 0, 254);
     }
     $data['meta_keywords'] = addslashes(htmlspecialchars(trim($elsettings->meta_keywords)));
     if (strlen($data['meta_keywords']) > 200) {
         $data['meta_keywords'] = substr($data['meta_keywords'], 0, 199);
     }
     $curimage = JRequest::getVar('curimage', '', 'post', 'string');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         //check if user is allowed to edit events
         $editaccess = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
         $maintainer = ELUser::ismaintainer();
         if ($maintainer || $editaccess) {
             $allowedtoeditevent = 1;
         }
         if ($allowedtoeditevent == 0) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
         /*
          * Is editor the owner of the event
          * This extra Check is needed to make it possible
          * that the venue is published after an edit from an owner
          */
         if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new events
         $maintainer = ELUser::ismaintainer();
         $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
         if ($maintainer || $genaccess) {
             $dellink = 1;
         }
         if ($dellink == 0) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //Set owneredit to false
         $owneredit = 0;
     }
     /*
      * Autopublish
      * check if the user has the required rank for autopublish
      */
     $autopubev = ELUser::validate_user($elsettings->evpubrec, $elsettings->autopubl);
     if ($autopubev || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/events/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $mainframe->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->datimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->datimage = $curimage;
     }
     //end image if
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check datdescription --> wipe out code
         $row->datdescription = strip_tags($row->datdescription, '<br><br/>');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->datdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->datdescription);
         // cut too long words
         $row->datdescription = wordwrap($row->datdescription, 75, ' ', 1);
         //check length
         $length = JString::strlen($row->datdescription);
         if ($length > $elsettings->datdesclimit) {
             //too long then shorten datdescription
             $row->datdescription = JString::substr($row->datdescription, 0, $elsettings->datdesclimit);
             //add ...
             $row->datdescription = $row->datdescription . '...';
         }
     }
     $row->title = trim(JFilterOutput::ampReplace($row->title));
     //set registration regarding the el settings
     switch ($elsettings->showfroregistra) {
         case 0:
             $row->registra = 0;
             break;
         case 1:
             $row->registra = 1;
             break;
         case 2:
             $row->registra = $row->registra;
             break;
     }
     switch ($elsettings->showfrounregistra) {
         case 0:
             $row->unregistra = 0;
             break;
         case 1:
             $row->unregistra = 1;
             break;
         case 2:
             if ($elsettings->showfroregistra >= 1) {
                 $row->unregistra = $row->unregistra;
             } else {
                 $row->unregistra = 0;
             }
             break;
     }
     //Make sure the table is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     //is this an edited event or not?
     //after store we allways have an id
     $edited = $row->id ? $row->id : false;
     //store it in the db
     if (!$row->store(true)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     $this->_db->setQuery('SELECT * FROM #__eventlist_venues WHERE id = ' . (int) $row->locid);
     $rowloc = $this->_db->loadObject();
     jimport('joomla.utilities.mail');
     $link = JURI::base() . JRoute::_('index.php?view=details&id=' . $row->id, false);
     //create the mail for the site owner
     if ($elsettings->mailinform == 1 || $elsettings->mailinform == 3) {
         $mail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('MAIL EVENT PUBLISHED', $link) : JText::_('MAIL EVENT UNPUBLISHED');
         if ($edited) {
             $modified_ip = getenv('REMOTE_ADDR');
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL EDIT EVENT', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $mail->setSubject($SiteName . JText::_('EDIT EVENT MAIL'));
         } else {
             $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL NEW EVENT', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $mail->setSubject($SiteName . JText::_('NEW EVENT MAIL'));
         }
         $receivers = explode(',', trim($elsettings->mailinformrec));
         $mail->addRecipient($receivers);
         $mail->setSender(array($MailFrom, $FromName));
         $mail->setBody($mailbody);
         $sent = $mail->Send();
     }
     //mail end
     //create the mail for the user
     if ($elsettings->mailinformuser == 1 || $elsettings->mailinformuser == 3) {
         $usermail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('USER MAIL EVENT PUBLISHED', $link) : JText::_('USER MAIL EVENT UNPUBLISHED');
         if ($edited) {
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL EDIT EVENT', $user->name, $user->username, $edited, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $usermail->setSubject($SiteName . JText::_('EDIT USER EVENT MAIL'));
         } else {
             $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL NEW EVENT', $user->name, $user->username, $created, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $usermail->setSubject($SiteName . JText::_('NEW USER EVENT MAIL'));
         }
         $usermail->addRecipient($user->email);
         $usermail->setSender(array($MailFrom, $FromName));
         $usermail->setBody($mailbody);
         $sent = $usermail->Send();
     }
     return $row->id;
 }
예제 #8
0
 /**
  * Creates the output for the details view
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe;
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $elsettings = ELHelper::config();
     $row =& $this->get('Details');
     $registers =& $this->get('Registers');
     $regcheck =& $this->get('Usercheck');
     //cleanup events
     ELHelper::cleanevents($elsettings->lastupdate);
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_eventlist');
     //Check if the id exists
     if ($row->did == 0) {
         return JError::raiseError(404, JText::sprintf('Event #%d not found', $row->did));
     }
     //Check if user has access to the details
     if ($elsettings->showdetails == 0) {
         return JError::raiseError(403, JText::_('NO ACCESS'));
     }
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Print
     $pop = JRequest::getBool('pop');
     $params->def('page_title', JText::_('DETAILS'));
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=details&id=' . $row->slug . '&pop=1&tmpl=component');
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->addItem(JText::_('DETAILS') . ' - ' . $row->title, JRoute::_('index.php?view=details&id=' . $row->slug));
     //Get images
     $dimage = ELImage::flyercreator($row->datimage, $elsettings, 'event');
     $limage = ELImage::flyercreator($row->locimage, $elsettings);
     //Check user if he can edit
     $allowedtoeditevent = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
     $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->venueowner, $elsettings->venueeditrec, $elsettings->venueedit);
     //Generate Date
     $date = strftime($elsettings->formatdate, strtotime($row->dates));
     if ($row->times) {
         $time = strftime($elsettings->formattime, strtotime($row->times));
     }
     if (!$row->enddates) {
         $displaydate = $date . '<br />';
     } else {
         $enddate = strftime($elsettings->formatdate, strtotime($row->enddates));
         $displaydate = $date . ' - ' . $enddate . '<br />';
     }
     //Generate Time
     if ($elsettings->showtimedetails == 1 && $row->times) {
         $starttime = $time . ' ' . $elsettings->timename;
         if ($row->endtimes) {
             $endtime = strftime($elsettings->formattime, strtotime($row->endtimes));
             $endtime = ' - ' . $endtime . ' ' . $elsettings->timename;
             $displaytime = $starttime . $endtime;
         } else {
             $displaytime = $starttime;
         }
     }
     //Timecheck for registration
     $jetzt = date("Y-m-d");
     $now = strtotime($jetzt);
     $date = strtotime($row->dates);
     $timecheck = $now - $date;
     //let's build the registration handling
     $formhandler = 0;
     //is the user allready registered at the event
     if ($regcheck) {
         $formhandler = 3;
     } else {
         //no, he isn't
         $formhandler = 4;
     }
     //check if it is too late to register and overwrite $formhandler
     if ($timecheck > 0) {
         $formhandler = 1;
     }
     //is the user registered at joomla and overwrite $formhandler if not
     if (!$user->get('id')) {
         $formhandler = 2;
     }
     //Generate Eventdescription
     if ($row->datdescription == '' || $row->datdescription == '<br />') {
         $eventdescription = JText::_('NO DESCRIPTION');
     } else {
         //Execute Plugins
         $row->text = $row->datdescription;
         //$row->title = $row->title;
         JPluginHelper::importPlugin('content');
         $results = $mainframe->triggerEvent('onPrepareContent', array(&$row, &$params, 0));
         $eventdescription = $row->text;
     }
     //Generate Venuedescription
     if (empty($row->locdescription)) {
         $venuedescription = JText::_('NO DESCRIPTION');
     } else {
         //execute plugins
         $row->text = $row->locdescription;
         //$row->title = $row->venue;
         JPluginHelper::importPlugin('content');
         $results = $mainframe->triggerEvent('onPrepareContent', array(&$row, &$params, 0));
         $venuedescription = $row->text;
     }
     // generate Metatags
     $meta_keywords_content = "";
     if (!empty($row->meta_keywords)) {
         $keywords = explode(",", $row->meta_keywords);
         foreach ($keywords as $keyword) {
             if ($meta_keywords_content != "") {
                 $meta_keywords_content .= ", ";
             }
             if (ereg("[/[/]", $keyword)) {
                 $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword)));
                 $meta_keywords_content .= $this->keyword_switcher($keyword, $row, $elsettings->formattime, $elsettings->formatdate);
             } else {
                 $meta_keywords_content .= $keyword;
             }
         }
     }
     if (!empty($row->meta_description)) {
         $description = explode("[", $row->meta_description);
         $description_content = "";
         foreach ($description as $desc) {
             $keyword = substr($desc, 0, strpos($desc, "]", 0));
             if ($keyword != "") {
                 $description_content .= $this->keyword_switcher($keyword, $row, $elsettings->formattime, $elsettings->formatdate);
                 $description_content .= substr($desc, strpos($desc, "]", 0) + 1);
             } else {
                 $description_content .= $desc;
             }
         }
     } else {
         $description_content = "";
     }
     //set page title and meta stuff
     $document->setTitle($item->name . ' - ' . $row->title);
     $document->setMetadata('keywords', $meta_keywords_content);
     $document->setDescription(strip_tags($description_content));
     //build the url
     if (!empty($row->url) && strtolower(substr($row->url, 0, 7)) != "http://") {
         $row->url = 'http://' . $row->url;
     }
     //create flag
     if ($row->country) {
         $row->countryimg = ELOutput::getFlag($row->country);
     }
     //assign vars to jview
     $this->assignRef('row', $row);
     $this->assignRef('params', $params);
     $this->assignRef('allowedtoeditevent', $allowedtoeditevent);
     $this->assignRef('allowedtoeditvenue', $allowedtoeditvenue);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('limage', $limage);
     $this->assignRef('displaytime', $displaytime);
     $this->assignRef('displaydate', $displaydate);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('eventdescription', $eventdescription);
     $this->assignRef('venuedescription', $venuedescription);
     $this->assignRef('registers', $registers);
     $this->assignRef('formhandler', $formhandler);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
예제 #9
0
 /**
  * Method to store the event
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $cats = JRequest::getVar('cid', array(), 'post', 'array');
     $row =& JTable::getInstance('eventlist_events', '');
     //Sanitize
     $data['datdescription'] = JRequest::getVar('datdescription', '', 'post', 'string', JREQUEST_ALLOWRAW);
     //include the metatags
     if (strlen($data['meta_description']) > 255) {
         $data['meta_description'] = substr($data['meta_description'], 0, 254);
     }
     if (strlen($data['meta_keywords']) > 200) {
         $data['meta_keywords'] = substr($data['meta_keywords'], 0, 199);
     }
     $curimage = JRequest::getVar('curimage', '', 'post', 'string');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //get values from time selectlist and concatenate them accordingly
     $starthours = JRequest::getCmd('starthours');
     $startminutes = JRequest::getCmd('startminutes');
     $endhours = JRequest::getCmd('endhours');
     $endminutes = JRequest::getCmd('endminutes');
     $row->times = $starthours . ':' . $startminutes;
     $row->endtimes = $endhours . ':' . $endminutes;
     //Are we saving from an item edit?
     if ($row->id) {
         //check if user is allowed to edit events
         $editaccess = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
         $maintainer = ELUser::ismaintainer();
         if ($maintainer || $editaccess) {
             $allowedtoeditevent = 1;
         }
         if ($allowedtoeditevent == 0) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
         /*
          * Is editor the owner of the event
          * This extra Check is needed to make it possible
          * that the venue is published after an edit from an owner
          */
         if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new events
         $maintainer = ELUser::ismaintainer();
         $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
         if (!($maintainer || $genaccess)) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //Set owneredit to false
         $owneredit = 0;
     }
     /*
      * Autopublish
      * check if the user has the required rank for autopublish
      */
     $autopubev = ELUser::validate_user($elsettings->evpubrec, $elsettings->autopubl);
     if ($autopubev || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/events/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $app->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->datimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->datimage = $curimage;
     }
     //end image if
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check datdescription --> wipe out code
         $row->datdescription = strip_tags($row->datdescription, '<br><br/>');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->datdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->datdescription);
         // cut too long words
         $row->datdescription = wordwrap($row->datdescription, 75, ' ', 1);
         //check length
         $length = JString::strlen($row->datdescription);
         if ($length > $elsettings->datdesclimit) {
             //too long then shorten datdescription
             $row->datdescription = JString::substr($row->datdescription, 0, $elsettings->datdesclimit);
             //add ...
             $row->datdescription = $row->datdescription . '...';
         }
     }
     //set registration regarding the el settings
     switch ($elsettings->showfroregistra) {
         case 0:
             $row->registra = 0;
             break;
         case 1:
             $row->registra = 1;
             break;
         case 2:
             $row->registra = $row->registra;
             break;
     }
     switch ($elsettings->showfrounregistra) {
         case 0:
             $row->unregistra = 0;
             break;
         case 1:
             $row->unregistra = 1;
             break;
         case 2:
             if ($elsettings->showfroregistra >= 1) {
                 $row->unregistra = $row->unregistra;
             } else {
                 $row->unregistra = 0;
             }
             break;
     }
     //Make sure the table is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     $row->version++;
     //store it in the db
     if (!$row->store(true)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //store cat relation
     $query = 'DELETE FROM #__eventlist_cats_event_relations WHERE itemid = ' . $row->id;
     $this->_db->setQuery($query);
     $this->_db->query();
     foreach ($cats as $cat) {
         $query = 'INSERT INTO #__eventlist_cats_event_relations (`catid`, `itemid`) VALUES(' . $cat . ',' . $row->id . ')';
         $this->_db->setQuery($query);
         $this->_db->query();
     }
     return $row->id;
 }
예제 #10
0
 /**
  * Creates the output for the details view
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $dispatcher =& JDispatcher::getInstance();
     $elsettings =& ELHelper::config();
     $row =& $this->get('Details');
     $categories =& $this->get('Categories');
     $registers =& $this->get('Registers');
     $regcheck =& $this->get('Usercheck');
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     //Check if the id exists
     if ($row->did == 0) {
         return JError::raiseError(404, JText::sprintf('Event #%d not found', $row->did));
     }
     //Check if user has access to the details
     if ($elsettings->showdetails == 0) {
         return JError::raiseError(403, JText::_('NO ACCESS'));
     }
     $cid = JRequest::getInt('cid', 0);
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Print
     $pop = JRequest::getBool('pop');
     $params->def('page_title', JText::_('DETAILS'));
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=details&cid=' . $cid . '&id=' . $row->slug . '&pop=1&tmpl=component');
     //pathway
     $cats = new eventlist_cats($cid);
     $parents = $cats->getParentlist();
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     foreach ($parents as $parent) {
         $pathway->addItem($this->escape($parent->catname), JRoute::_('index.php?view=categoryevents&id=' . $parent->categoryslug));
     }
     $pathway->addItem($this->escape($row->title), JRoute::_('index.php?view=details&cid=' . $cid . '&id=' . $row->slug));
     //Get images
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     $limage = ELImage::flyercreator($row->locimage);
     //Check user if he can edit
     $allowedtoeditevent = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
     $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->venueowner, $elsettings->venueeditrec, $elsettings->venueedit);
     //Timecheck for registration
     $jetzt = date("Y-m-d");
     $now = strtotime($jetzt);
     $date = strtotime($row->dates);
     $timecheck = $now - $date;
     //let's build the registration handling
     $formhandler = 0;
     //is the user allready registered at the event
     if ($regcheck) {
         $formhandler = 3;
     } else {
         //no, he isn't
         $formhandler = 4;
     }
     //check if it is too late to register and overwrite $formhandler
     if ($timecheck > 0) {
         $formhandler = 1;
     }
     //is the user registered at joomla and overwrite $formhandler if not
     if (!$user->get('id')) {
         $formhandler = 2;
     }
     if ($formhandler >= 3) {
         $js = "function check(checkbox, senden) {\n\t\t\t\tif(checkbox.checked==true){\n\t\t\t\t\tsenden.disabled = false;\n\t\t\t\t} else {\n\t\t\t\t\tsenden.disabled = true;\n\t\t\t\t}}";
         $document->addScriptDeclaration($js);
     }
     //Generate Eventdescription
     if (!$row->datdescription == '' || !$row->datdescription == '<br />') {
         //Execute Plugins
         $row->text = $row->datdescription;
         JPluginHelper::importPlugin('content');
         $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0));
         $row->datdescription = $row->text;
     }
     //Generate Venuedescription
     if (!$row->locdescription == '' || !$row->locdescription == '<br />') {
         //execute plugins
         $row->text = $row->locdescription;
         JPluginHelper::importPlugin('content');
         $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0));
         $row->locdescription = $row->text;
     }
     // generate Metatags
     $meta_keywords_content = "";
     if (!empty($row->meta_keywords)) {
         $keywords = explode(",", $row->meta_keywords);
         foreach ($keywords as $keyword) {
             if ($meta_keywords_content != "") {
                 $meta_keywords_content .= ", ";
             }
             if (preg_match("/[\\/[\\/]/", $keyword)) {
                 $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword)));
                 $buffer = $this->keyword_switcher($keyword, $row, $categories, $elsettings->formattime, $elsettings->formatdate);
                 if ($buffer != "") {
                     $meta_keywords_content .= $buffer;
                 } else {
                     $meta_keywords_content = substr($meta_keywords_content, 0, strlen($meta_keywords_content) - 2);
                     // remove the comma and the white space
                 }
             } else {
                 $meta_keywords_content .= $keyword;
             }
         }
     }
     if (!empty($row->meta_description)) {
         $description = explode("[", $row->meta_description);
         $description_content = "";
         foreach ($description as $desc) {
             $keyword = substr($desc, 0, strpos($desc, "]", 0));
             if ($keyword != "") {
                 $description_content .= $this->keyword_switcher($keyword, $row, $categories, $elsettings->formattime, $elsettings->formatdate);
                 $description_content .= substr($desc, strpos($desc, "]", 0) + 1);
             } else {
                 $description_content .= $desc;
             }
         }
     } else {
         $description_content = "";
     }
     //set page title and meta stuff
     $document->setTitle($row->title);
     $document->setMetadata('keywords', $meta_keywords_content);
     $document->setDescription(strip_tags($description_content));
     //build the url
     if (!empty($row->url) && strtolower(substr($row->url, 0, 7)) != "http://") {
         $row->url = 'http://' . $row->url;
     }
     //create flag
     if ($row->country) {
         $row->countryimg = ELOutput::getFlag($row->country);
     }
     // load dispatcher for plugins
     JPluginHelper::importPlugin('eventlist');
     $row->pluginevent = new stdClass();
     $results = $dispatcher->trigger('onEventDetailsEnd', array($row->did, $this->escape($row->title)));
     $row->pluginevent->onEventDetailsEnd = trim(implode("\n", $results));
     //assign vars to jview
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('params', $params);
     $this->assignRef('allowedtoeditevent', $allowedtoeditevent);
     $this->assignRef('allowedtoeditvenue', $allowedtoeditvenue);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('limage', $limage);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('registers', $registers);
     $this->assignRef('formhandler', $formhandler);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('user', $user);
     $this->assignRef('dispatcher', $dispatcher);
     parent::display($tpl);
 }
예제 #11
0
 /**
  * Creates the Venueevents View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings =& ELHelper::config();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     $uri =& JFactory::getURI();
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = $app->getUserStateFromRequest('com_eventlist.venueevents.limit', 'limit', $params->def('display_num', 0), 'int');
     $pop = JRequest::getBool('pop');
     $task = JRequest::getWord('task');
     //get data from model
     $rows =& $this->get('Data');
     $venue =& $this->get('Venue');
     $total =& $this->get('Total');
     //does the venue exist?
     if ($venue->id == 0) {
         return JError::raiseError(404, JText::sprintf('Venue #%d not found', $venue->id));
     }
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     // Add needed scripts if the lightbox effect is enabled
     if ($elsettings->lightbox == 1) {
         JHTML::_('behavior.modal');
     }
     //Get image
     $limage = ELImage::flyercreator($venue->locimage);
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=venueevents&format=feed&id=' . $venue->id;
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     //create the pathway
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE') . ' - ' . $venue->venue, JRoute::_('index.php?option=com_eventlist&view=venueevents&task=archive&id=' . $venue->slug));
         $link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug . '&task=archive');
         $print_link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug . '&task=archive&pop=1&tmpl=component');
         $pagetitle = $venue->venue . ' - ' . JText::_('ARCHIVE');
     } else {
         $pathway->addItem($venue->venue, JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug));
         $link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug);
         $print_link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug . '&pop=1&tmpl=component');
         $pagetitle = $venue->venue;
     }
     //set Page title
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     $document->setMetadata('keywords', $venue->meta_keywords);
     $document->setDescription(strip_tags($venue->meta_description));
     //Printfunction
     $params->def('print', !$app->getCfg('hidePrint'));
     $params->def('icons', $app->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //Generate Venuedescription
     if (!$venue->locdescription == '' || !$venue->locdescription == '<br />') {
         //execute plugins
         $venue->text = $venue->locdescription;
         $venue->title = $venue->venue;
         JPluginHelper::importPlugin('content');
         $results = $app->triggerEvent('onPrepareContent', array(&$venue, &$params, 0));
         $venuedescription = $venue->text;
     }
     $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $venue->created, $elsettings->venueeditrec, $elsettings->venueedit);
     //build the url
     if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
         $venue->url = 'http://' . $venue->url;
     }
     //prepare the url for output
     if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
         $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
     } else {
         $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
     }
     //create flag
     if ($venue->country) {
         $venue->countryimg = ELOutput::getFlag($venue->country);
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //create select lists
     $lists = $this->_buildSortLists($elsettings);
     $this->assign('lists', $lists);
     $this->assign('action', $uri->toString());
     $this->assignRef('rows', $rows);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('venue', $venue);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('limage', $limage);
     $this->assignRef('venuedescription', $venuedescription);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('task', $task);
     $this->assignRef('allowedtoeditvenue', $allowedtoeditvenue);
     parent::display($tpl);
 }
예제 #12
0
?>
">
								<?php 
echo JText::_('GD LIBRARY');
?>
							</span>
						</td>
       					<td valign="top">
         					<?php 
$mode = 0;
if ($this->elsettings->gddisabled == 1) {
    $mode = 1;
}
// if
//is the gd library installed on the server running EventList?
if ($gdv = ELImage::gdVersion()) {
    //is it Version two or higher? If yes let the user the choice
    if ($gdv >= 2) {
        ?>
       								<input type="radio" id="gddisabled0" name="gddisabled" value="0" onclick="changegdMode(0)"<?php 
        if (!$mode) {
            echo ' checked="checked"';
        }
        ?>
/><?php 
        echo JText::_('NO');
        ?>
									<input type="radio" id="gddisabled1" name="gddisabled" value="1" onclick="changegdMode(1)"<?php 
        if ($mode) {
            echo ' checked="checked"';
        }
예제 #13
0
파일: helper.php 프로젝트: julienV/testrepo
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 function getList(&$params)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $user_gid = (int) $user->get('aid');
     //all upcoming events
     if ($params->get('type') == 1) {
         $where = ' WHERE a.dates > CURDATE()';
         //	$where = ' WHERE a.published = 1';
         $order = ' ORDER BY a.dates, a.times';
     }
     //archived events only
     if ($params->get('type') == 2) {
         $where = ' WHERE a.published = -1';
         $order = ' ORDER BY a.dates DESC, a.times DESC';
     }
     //currently running events only
     if ($params->get('type') == 3) {
         $where = ' WHERE a.published = 1';
         $where .= ' AND ( a.dates = CURDATE()';
         $where .= ' OR ( a.enddates >= CURDATE() AND a.dates <= CURDATE() ))';
         $order = ' ORDER BY a.dates, a.times';
     }
     //clean parameter data
     $catid = trim($params->get('catid'));
     $venid = trim($params->get('venid'));
     $state = JString::strtolower(trim($params->get('stateloc')));
     //Build category selection query statement
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $categories = ' AND (c.id=' . implode(' OR c.id=', $ids) . ')';
     }
     //Build venue selection query statement
     if ($venid) {
         $ids = explode(',', $venid);
         JArrayHelper::toInteger($ids);
         $venues = ' AND (l.id=' . implode(' OR l.id=', $ids) . ')';
     }
     //Build state selection query statement
     if ($state) {
         $rawstate = explode(',', $state);
         foreach ($rawstate as $val) {
             if ($val) {
                 $states[] = '"' . trim($db->getEscaped($val)) . '"';
             }
         }
         JArrayHelper::toString($states);
         $stat = ' AND (LOWER(l.state)=' . implode(' OR LOWER(l.state)=', $states) . ')';
     }
     //perform select query
     $query = 'SELECT a.title, a.dates, a.enddates, a.times, a.endtimes, a.datdescription, a.datimage, l.venue, l.state, l.locimage, l.city, l.locdescription, c.catname,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(\':\', l.id, l.alias) ELSE l.id END as venueslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ' FROM #__eventlist_events AS a' . ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid' . ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid' . $where . ' AND c.access <= ' . $user_gid . ($catid ? $categories : '') . ($venid ? $venues : '') . ($state ? $stat : '') . $order . ' LIMIT ' . (int) $params->get('count', '2');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     //assign datemethod value to jview
     jimport('joomla.application.component.view');
     JView::assignRef('datemethod', $params->get('datemethod', 1));
     JView::assignRef('use_modal', $params->get('use_modal', 0));
     if ($params->get('use_modal', 0)) {
         JHTML::_('behavior.modal');
     }
     //Loop through the result rows and prepare data
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         //create thumbnails if needed and receive imagedata
         $dimage = ELImage::flyercreator($row->datimage, 'event');
         $limage = ELImage::flyercreator($row->locimage);
         //cut titel
         $length = strlen(htmlspecialchars($row->title));
         if ($length > $params->get('cuttitle', '25')) {
             $row->title = substr($row->title, 0, $params->get('cuttitle', '18'));
             $row->title = $row->title . '...';
         }
         $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
         $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
         $lists[$i]->catname = htmlspecialchars($row->catname, ENT_COMPAT, 'UTF-8');
         $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
         $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->slug)) : '';
         $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->venueslug, 'venueevents')) : '';
         $lists[$i]->categorylink = $params->get('linkcategory', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->categoryslug, 'categoryevents')) : '';
         $lists[$i]->date = modEventListwideHelper::_format_date($row, $params);
         $lists[$i]->time = $row->times ? modEventListwideHelper::_format_time($row->dates, $row->times, $params) : '';
         $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb'];
         $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original'];
         $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb'];
         $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original'];
         $lists[$i]->eventdescription = strip_tags($row->datdescription);
         $lists[$i]->venuedescription = strip_tags($row->locdescription);
         $i++;
     }
     return $lists;
 }
예제 #14
0
 /**
  * Method to store the venue
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     global $mainframe;
     jimport('joomla.utilities.date');
     $user =& JFactory::getUser();
     $elsettings = ELHelper::config();
     //Get mailinformation
     $SiteName = $mainframe->getCfg('sitename');
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $tzoffset = $mainframe->getCfg('offset');
     $row =& JTable::getInstance('eventlist_venues', '');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         $owner = ELUser::isOwner($row->id, 'venues');
         //check if user is allowed to edit venues
         $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $owner, $elsettings->venueeditrec, $elsettings->venueedit);
         if ($allowedtoeditvenue == 0) {
             $row->checkin();
             $mainframe->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         $date = new JDate($row->modified, $tzoffset);
         $row->modified = $date->toMySQL();
         $row->modified_by = $user->get('id');
         //Is editor the owner of the venue
         //This extra Check is needed to make it possible
         //that the venue is published after an edit from an owner
         if ($elsettings->venueowner == 1 && $owner == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new venues
         $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
         if ($delloclink == 0) {
             $mainframe->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         //get IP, time and userid
         $date = new JDate($row->created, $tzoffset);
         $row->created = $date->toMySQL();
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //set owneredit to false
         $owneredit = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/venues/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $mainframe->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->locimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->locimage = $row->curimage;
     }
     //end image upload if
     //Check description
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check datdescription --> wipe out code
         $row->locdescription = strip_tags($row->locdescription, '<br />');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription);
         //cut too long words
         $row->locdescription = wordwrap($row->locdescription, 75, " ", 1);
         //check length
         $length = JString::strlen($row->locdescription);
         if ($length > $elsettings->datdesclimit) {
             // if required shorten it
             $row->locdescription = JString::substr($row->locdescription, 0, $elsettings->datdesclimit);
             //if shortened add ...
             $row->locdescription = $row->locdescription . '...';
         }
     }
     $row->venue = trim(JFilterOutput::ampReplace($row->venue));
     //Autopublish
     //check if the user has the required rank for autopublish
     $autopublloc = ELUser::validate_user($elsettings->locpubrec, $elsettings->autopublocate);
     //Check if user is the owner of the venue
     //If yes enable autopublish
     if ($autopublloc || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     //Make sure the data is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     //is this an edited venue or not?
     //after store we allways have an id
     $edited = $row->id ? $row->id : false;
     //store it in the db
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     jimport('joomla.utilities.mail');
     $link = JURI::base() . JRoute::_('index.php?view=details&id=' . $row->id, false);
     //create mail
     if ($elsettings->mailinform == 2 || $elsettings->mailinform == 3) {
         $mail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('MAIL VENUE PUBLISHED', $link) : JText::_('MAIL VENUE UNPUBLISHED');
         if ($edited) {
             $modified_ip = getenv('REMOTE_ADDR');
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL EDIT VENUE', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $mail->setSubject($SiteName . JText::_('EDIT VENUE MAIL'));
         } else {
             $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL NEW VENUE', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $mail->setSubject($SiteName . JText::_('NEW VENUE MAIL'));
         }
         $receivers = explode(',', trim($elsettings->mailinformrec));
         $mail->addRecipient($receivers);
         $mail->setSender(array($MailFrom, $FromName));
         $mail->setBody($mailbody);
         $sent = $mail->Send();
     }
     //create the mail for the user
     if ($elsettings->mailinformuser == 2 || $elsettings->mailinformuser == 3) {
         $usermail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('USER MAIL VENUE PUBLISHED', $link) : JText::_('USER MAIL VENUE UNPUBLISHED');
         if ($edited) {
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL EDIT VENUE', $user->name, $user->username, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $usermail->setSubject($SiteName . JText::_('EDIT USER VENUE MAIL'));
         } else {
             $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL NEW VENUE', $user->name, $user->username, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $usermail->setSubject($SiteName . JText::_('NEW USER VENUE MAIL'));
         }
         $usermail->addRecipient($user->email);
         $usermail->setSender(array($MailFrom, $FromName));
         $usermail->setBody($mailbody);
         $sent = $usermail->Send();
     }
     //update item order
     $row->reorder();
     return $row->id;
 }
예제 #15
0
 /**
  * Creates the output for event submissions
  *
  * @since 0.4
  *
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $session =& JFactory::getSession();
     $user =& JFactory::getUser();
     if (!$user->id) {
         $app->redirect(JRoute::_($_SERVER["HTTP_REFERER"]), JText::_('Please login to be able to submit events'), 'error');
     }
     if ($this->getLayout() == 'choosevenue') {
         $this->_displaychoosevenue($tpl);
         return;
     }
     // Initialize variables
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     //Get Data from the model
     $row = $this->get('Event');
     //Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('Categories');
     //sticky form categorie data
     if ($session->has('eventform', 'com_eventlist')) {
         $eventform = $session->get('eventform', 0, 'com_eventlist');
         $selectedcats = $eventform['cid'];
     } else {
         $selectedcats =& $this->get('Catsselected');
     }
     //build selectlists
     $categories = eventlist_cats::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8 class="inputbox required validate-cid"');
     //Get requests
     $id = JRequest::getInt('id');
     //Clean output
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Set page title
     $id ? $title = JText::_('EDIT EVENT') : ($title = JText::_('ADD EVENT'));
     $doc->setTitle($title);
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Has the user access to the editor and the add venue screen
     $editoruser = ELUser::editoruser();
     $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->datdescription = ELHelper::br2break($row->datdescription);
     }
     //Get image information
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     //Create the stuff required for the venueselect functionality
     $url = $app->isAdmin() ? $app->getSiteURL() : JURI::base();
     $js = "\n\t\tfunction elSelectVenue(id, venue) {\n\t\t\tdocument.getElementById('a_id').value = id;\n\t\t\tdocument.getElementById('a_name').value = venue;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}\n\t\t\n\t\tfunction closeAdd() {\n\t\t\tdocument.getElementById('sbox-window').close();   \n    \t}\n    \t";
     $doc->addScriptDeclaration($js);
     // include the recurrence script
     $doc->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $doc->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     $lists = array();
     // recurrence type
     $rec_type = array();
     $rec_type[] = JHTML::_('select.option', 0, JText::_('NOTHING'));
     $rec_type[] = JHTML::_('select.option', 1, JText::_('DAYLY'));
     $rec_type[] = JHTML::_('select.option', 2, JText::_('WEEKLY'));
     $rec_type[] = JHTML::_('select.option', 3, JText::_('MONTHLY'));
     $rec_type[] = JHTML::_('select.option', 4, JText::_('WEEKDAY'));
     $lists['recurrence_type'] = JHTML::_('select.genericlist', $rec_type, 'recurrence_type', '', 'value', 'text', $row->recurrence_type);
     //if only owned events are allowed
     if ($elsettings->ownedvenuesonly) {
         $venues =& $this->get('UserVenues');
         //build list
         $venuelist = array();
         $venuelist[] = JHTML::_('select.option', '0', JText::_('NO VENUE'));
         $venuelist = array_merge($venuelist, $venues);
         $lists['venueselect'] = JHTML::_('select.genericlist', $venuelist, 'locid', 'size="1" class="inputbox"', 'value', 'text', $row->locid);
     }
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('editor', $editor);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('delloclink', $delloclink);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
예제 #16
0
 /**
  * Creates the output for event submissions
  *
  * @since 0.4
  *
  */
 function display($tpl = null)
 {
     global $mainframe;
     if ($this->getLayout() == 'selectvenue') {
         $this->_displayselectvenue($tpl);
         return;
     }
     // Initialize variables
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     //Get Data from the model
     $row = $this->Get('Event');
     $categories = $this->Get('Categories');
     //Get requests
     $id = JRequest::getInt('id');
     //Clean output
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Set page title
     $id ? $title = JText::_('EDIT EVENT') : ($title = JText::_('ADD EVENT'));
     $doc->setTitle($title);
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_eventlist');
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Has the user access to the editor and the add venue screen
     $editoruser = ELUser::editoruser();
     $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->datdescription = ELHelper::br2break($row->datdescription);
     }
     //Get image information
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     //Create the stuff required for the venueselect functionality
     $url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
     $js = "\r\n\t\tfunction elSelectVenue(id, venue) {\r\n\t\t\tdocument.getElementById('a_id').value = id;\r\n\t\t\tdocument.getElementById('a_name').value = venue;\r\n\t\t\tdocument.getElementById('sbox-window').close();\r\n\t\t}";
     $doc->addScriptDeclaration($js);
     // include the recurrence script
     $doc->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $doc->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('editor', $editor);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('delloclink', $delloclink);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #17
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     global $mainframe;
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings = ELHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $venue =& $this->_data[$i];
             //Create image information
             $venue->limage = ELImage::flyercreator($venue->locimage, $elsettings);
             //Generate Venuedescription
             if (empty($venue->locdescription)) {
                 $venue->locdescription = JText::_('NO DESCRIPTION');
             } else {
                 //execute plugins
                 $venue->text = $venue->locdescription;
                 $venue->title = $venue->venue;
                 JPluginHelper::importPlugin('content');
                 $results = $mainframe->triggerEvent('onPrepareContent', array(&$venue, &$params, 0));
                 $venue->locdescription = $venue->text;
             }
             //build the url
             if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
                 $venue->url = 'http://' . $venue->url;
             }
             //prepare the url for output
             if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
                 $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
             } else {
                 $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
             }
             //create flag
             if ($venue->country) {
                 $venue->countryimg = ELOutput::getFlag($venue->country);
             }
             //Get total of assigned events of each venue
             $venue->assignedevents = $this->_assignedevents($venue->id);
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }